Error handlers that hand back the internals
Stack Traces Exposed in API Responses
Why this workflow produces it
The generated catch block is almost always the same three lines: catch the error, put its message in the body, return a 500. It is a reasonable thing to write while building, nothing misbehaves afterwards, and so it never comes up again.
What ships to the caller is your ORM's error text, your table and column names, and often the query that failed — a free map of your schema for anyone who sends a deliberately malformed request and reads the reply.
The change that prevents it
Ask for the error contract explicitly, once, and it applies to every handler generated afterwards. Log the real error server-side, return a generic message and a correlation id to the caller.
Paste this into your project instructions, or into the prompt itself:
Every server error response returns a generic message and a random correlation id, never error.message and never a stack. Log the full error with that same id server-side so it can still be traced. Apply this to every handler you generate.
The scan that verifies it
Scan, then confirm by hand: send a request that is guaranteed to fail and read the response body. It should tell you nothing you did not already know about your database.
npx xploitscan scan . -f json \ | jq '[.findings[] | select(.rule == "VC037")] | length'