mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
JavaScript: Improve StackTraceExposure query.
It now also flags exposure of the entire exception object (not just the `stack` property).
This commit is contained in:
@@ -1 +1,3 @@
|
||||
| node.js:11:13:11:21 | err.stack | Stack trace information from $@ may be exposed to an external user here. | node.js:11:13:11:21 | err.stack | here |
|
||||
| node.js:11:13:11:21 | err.stack | Stack trace information from $@ may be exposed to an external user here. | node.js:8:10:8:12 | err | here |
|
||||
| tst.js:7:13:7:13 | e | Stack trace information from $@ may be exposed to an external user here. | tst.js:6:12:6:12 | e | here |
|
||||
| tst.js:17:11:17:17 | e.stack | Stack trace information from $@ may be exposed to an external user here. | tst.js:6:12:6:12 | e | here |
|
||||
|
||||
18
javascript/ql/test/query-tests/Security/CWE-209/tst.js
Normal file
18
javascript/ql/test/query-tests/Security/CWE-209/tst.js
Normal file
@@ -0,0 +1,18 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user