Skip to content

Commit ea8edb8

Browse files
author
Alvaro Muñoz
committed
initial tests
1 parent 2ab34c8 commit ea8edb8

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import javascript
2+
import semmle.javascript.security.dataflow.ReflectedXssCustomizations
3+
4+
query predicate test_XSS(ReflectedXss::Sink sink, Http::ResponseSendArgument res) {
5+
sink = res
6+
}

javascript/ql/test/library-tests/frameworks/Express/src/express.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ app.post('/some/other/path', function(req, res) {
3434
app.get('/', require('./exportedHandler.js').handler);
3535

3636
function getHandler() {
37-
return function (req, res){}
37+
return function(req, res) { }
3838
}
3939
app.use(getHandler());
4040

4141
function getArrowHandler() {
42-
return (req, res) => f();
42+
return (req, res) => f();
4343
}
4444
app.use(getArrowHandler());
4545

@@ -49,3 +49,21 @@ app.post('/headers', function(req, res) {
4949
req.hostname;
5050
req.headers[config.headerName];
5151
});
52+
53+
app.get('/some/xss1', function(req, res) {
54+
res.header("Content-Type", "text/html");
55+
res.send(req.params.foo)
56+
foo(res);
57+
});
58+
59+
app.get('/some/xss2', function(req, res) {
60+
res.header("Content-Type", "application/xml");
61+
res.send(req.params.foo)
62+
foo(res);
63+
});
64+
65+
app.get('/some/non-xss1', function(req, res) {
66+
res.header("Content-Type", "text/plain");
67+
res.send(req.params.foo)
68+
foo(res);
69+
});

0 commit comments

Comments
 (0)