Skip to content

Commit f7654d6

Browse files
committed
JS: Add test
1 parent fa95871 commit f7654d6

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

javascript/ql/test/query-tests/Security/CWE-094/CodeInjection/CodeInjection.expected

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ nodes
5555
| tst.js:23:11:23:27 | document.location |
5656
| tst.js:23:11:23:32 | documen ... on.hash |
5757
| tst.js:23:11:23:45 | documen ... ring(1) |
58+
| tst.js:26:26:26:33 | location |
59+
| tst.js:26:26:26:40 | location.search |
60+
| tst.js:26:26:26:53 | locatio ... ring(1) |
5861
edges
5962
| angularjs.js:10:22:10:29 | location | angularjs.js:10:22:10:36 | location.search |
6063
| angularjs.js:13:23:13:30 | location | angularjs.js:13:23:13:37 | location.search |
@@ -93,6 +96,8 @@ edges
9396
| tst.js:23:11:23:27 | document.location | tst.js:23:11:23:32 | documen ... on.hash |
9497
| tst.js:23:11:23:32 | documen ... on.hash | tst.js:23:11:23:45 | documen ... ring(1) |
9598
| tst.js:23:11:23:45 | documen ... ring(1) | tst.js:23:6:23:46 | atob(do ... ing(1)) |
99+
| tst.js:26:26:26:33 | location | tst.js:26:26:26:40 | location.search |
100+
| tst.js:26:26:26:40 | location.search | tst.js:26:26:26:53 | locatio ... ring(1) |
96101
#select
97102
| angularjs.js:10:22:10:36 | location.search | angularjs.js:10:22:10:29 | location | angularjs.js:10:22:10:36 | location.search | $@ flows to here and is interpreted as code. | angularjs.js:10:22:10:29 | location | User-provided value |
98103
| angularjs.js:13:23:13:37 | location.search | angularjs.js:13:23:13:30 | location | angularjs.js:13:23:13:37 | location.search | $@ flows to here and is interpreted as code. | angularjs.js:13:23:13:30 | location | User-provided value |
@@ -120,3 +125,4 @@ edges
120125
| tst.js:17:21:17:42 | documen ... on.hash | tst.js:17:21:17:37 | document.location | tst.js:17:21:17:42 | documen ... on.hash | $@ flows to here and is interpreted as code. | tst.js:17:21:17:37 | document.location | User-provided value |
121126
| tst.js:20:30:20:51 | documen ... on.hash | tst.js:20:30:20:46 | document.location | tst.js:20:30:20:51 | documen ... on.hash | $@ flows to here and is interpreted as code. | tst.js:20:30:20:46 | document.location | User-provided value |
122127
| tst.js:23:6:23:46 | atob(do ... ing(1)) | tst.js:23:11:23:27 | document.location | tst.js:23:6:23:46 | atob(do ... ing(1)) | $@ flows to here and is interpreted as code. | tst.js:23:11:23:27 | document.location | User-provided value |
128+
| tst.js:26:26:26:53 | locatio ... ring(1) | tst.js:26:26:26:33 | location | tst.js:26:26:26:53 | locatio ... ring(1) | $@ flows to here and is interpreted as code. | tst.js:26:26:26:33 | location | User-provided value |

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ WebAssembly.compileStreaming(document.location.hash);
2121

2222
// NOT OK
2323
eval(atob(document.location.hash.substring(1)));
24+
25+
// NOT OK
26+
$('<a>').attr("onclick", location.search.substring(1));

0 commit comments

Comments
 (0)