Three endpoints answer 500 to malformed input instead of 400

Aperta
#129 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
nodejs, openapi, typescript

Direzione di ricerca

Start from the OpenAPI document mentioned in the issue and locate the controllers for /api/v1/leave/calendar, /api/v1/notifications/devices and /api/v1/files/upload in the NestJS app, then check how the global validation pipe and each handler's DTO treat a missing query string, empty body and wrong Content-Type. Reproduce each call first to confirm the 500, then make the handlers reject with VALIDATION_FAILED naming the missing from/to dates or the absent file part. Done means all three return 400 (or 415 for the upload) with a useful message and route-level tests cover the malformed cases.

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

Descrizione

bug

Found in the Pilot A gate (QA, main 147829f). Synthetic data only. No security impact: the production error body is the generic INTERNAL_ERROR ("An unexpected error occurred") with a request id, no stack.

Each call is made as a signed-in employee (any role gives the same answer).

Call Actual Expected
GET /api/v1/leave/calendar with no from and to 500 INTERNAL_ERROR 400 VALIDATION_FAILED naming the missing dates (the same call with ?from=2026-11-01&to=2026-12-31 works)
DELETE /api/v1/notifications/devices with no body 500 INTERNAL_ERROR 400 VALIDATION_FAILED
POST /api/v1/files/upload with Content-Type: application/json and body {} (not multipart) 500 INTERNAL_ERROR 400 or 415 ("send one part named file")

Found by sending an empty body or no query string to all 249 routes of the OpenAPI document with each role; these three were the only 5xx answers.

A caller who forgets a parameter should be told which one; the 500 also shows up in error monitoring as a fault in Cwork.

Lingua principale
TypeScript
Stelle
0
Fork
0
Merge medio
45m
PR unite (30g)
37

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 SuruchBoss/Cwork

Tutte le issue di SuruchBoss/Cwork

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.