[BUG] Weekly AI summary quota race and unbounded request body

Abierto
#4,053 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@IshantXM ya está trabajando en esto.

Desde el 3/12/2026.

  • #4055 de @IshantXM — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
1-2 días
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
next.js, supabase, typescript
Área
api, backend, security

Línea de trabajo

Start at the /api/ai/weekly-summary route and trace how it checks the 24-hour limit, parses JSON, generates the summary, and persists the timestamp. The report identifies a race and missing body-size limit; a linked open pull request (#4055) is already addressing the issue.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

What happened?

Code review found two defects in the weekly AI summary API. First, its 24-hour limit was checked separately from model generation and persistence, allowing simultaneous requests for one user to trigger duplicate paid provider calls. Second, the route parsed request JSON without a body-size limit, so oversized inputs could consume excessive memory before validation.

Expected behavior is to atomically claim a user's generation window and bound request parsing before quota or provider work. These defects were identified in source review; they were not reproduced against the live deployment.

Steps to reproduce
  1. On a revision before the fix, send concurrent authenticated POST requests to /api/ai/weekly-summary for the same user; each can pass the timestamp read before any request writes it.
  2. Send a valid JSON request body larger than 8 KiB; the route parses it without an input cap.
  3. Observe concurrent model calls or unbounded body parsing.
Where is it?

API

Where did you see it?

Local development (code review; not reproduced against the live deployment)

Want to fix it?
  • I'd like to work on this. A maintainer will assign you; please don't start before that.
Lenguaje dominante
TypeScript
Estrellas
246
Forks
436
Merge medio
9 h 33 min
PR fusionados (30 d)
213

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Priyanshu-byte-coder/devtrack

Todos los issues de Priyanshu-byte-coder/devtrack

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.