Files
Max Schaefer bdfe938d02 JavaScript: Improve StackTraceExposure query.
It now also flags exposure of the entire exception object (not just the `stack` property).
2018-11-09 09:42:09 +00:00

19 lines
456 B
JavaScript

var http = require('http');
http.createServer(function onRequest(req, res) {
try {
throw new Error();
} catch (e) {
res.end(e); // NOT OK
fail(res, e);
res.end(e.message); // OK
res.end("Caught exception " + e); // OK
res.end(e.toString()); // OK
res.end(`Caught exception ${e}.`); // OK
}
});
function fail(res, e) {
res.end(e.stack); // NOT OK
}