GPT-5 finding
Invalid JSON bodies cause unhandled exception and 500 instead of a 400 client error
- dashboard/app/api/secrets/route.ts:84
- dashboard/app/api/secrets/route.ts:112
await request.json() throws on invalid/malformed JSON. Without a try/catch, the handler returns a 500 instead of a 400 with a helpful message, violating API contract expectations for client input errors.
Recommendation
Wrap JSON parsing in try/catch and return 400 on parse errors; also validate Content-Type is application/json and that fields are strings of expected shape.