Stack trace exposure (ARCH3127)
Ce contenu n’est pas encore disponible dans votre langue.
Key typescript.security.stack-trace-exposure · Severity warning · Category security · CWE CWE-209
Writing exception details and stack traces to the HTTP response leaks internal file paths and application structure to the client.
Incorrect
Section titled “Incorrect”app.use((err, req, res, next) => { // Stack trace sent to the client res.status(500).send(err.stack);});Correct
Section titled “Correct”app.use((err, req, res, next) => { logger.error(err); res.status(500).json({ error: "Internal Server Error" });});Log error details only on the server side; return a generic error message to the client.