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

Aperta
#4,053 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@IshantXM ci sta già lavorando.

Dal 3/12/2026.

  • #4055 di @IshantXM — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
1-2 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
next.js, supabase, typescript
Ambito
api, backend, security

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
TypeScript
Stelle
246
Fork
436
Merge medio
9h 33m
PR unite (30g)
213

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Priyanshu-byte-coder/devtrack

Tutte le issue di Priyanshu-byte-coder/devtrack

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.