scar-005 · scar
Stack trace leaked to the client
An error handler sent the raw stack trace in the HTTP response, exposing file paths and internals.
Before and after
Before · the mistake
1res.status(500).send(err.stack)After · the rule
1Log the error on the server and send a generic message: res.status(500).send('Something went wrong')How it’s detected
res\.(status\(\d+\)\.)?(send|json)\(\s*err(or)?\.stackTimes it came back
This mistake has not been repeated. The rule is working.