Skip to content

Commit 7492293

Browse files
committed
JS: Add test with route handler indirection
1 parent 3cbe94a commit 7492293

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| query-tests/Security/CWE-073/routes.js:2 | expected an alert, but found none | NOT OK | |
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
exports.foo = function(req, res) {
2+
res.render('foo', req.body); // NOT OK
3+
}

javascript/ql/test/query-tests/Security/CWE-073/tst.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,7 @@ function indirect(res, obj) {
2727
res.render("template", str); // OK
2828

2929
res.render("template", JSON.parse(str)); // NOT OK
30-
}
30+
}
31+
32+
let routes = require('./routes');
33+
app.post('/foo', routes.foo);

0 commit comments

Comments
 (0)