Skip to content

Commit 7f538e8

Browse files
committed
JS: add test case for non-whitelisted use of location
1 parent 02978c9 commit 7f538e8

3 files changed

Lines changed: 5 additions & 0 deletions

File tree

javascript/ql/test/query-tests/Security/CWE-079/StoredXss.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ nodes
217217
| tst.js:272:9:272:32 | loc3 |
218218
| tst.js:272:16:272:32 | document.location |
219219
| tst.js:275:7:275:10 | loc3 |
220+
| tst.js:277:22:277:29 | location |
220221
| winjs.js:2:7:2:53 | tainted |
221222
| winjs.js:2:17:2:33 | document.location |
222223
| winjs.js:2:17:2:40 | documen ... .search |

javascript/ql/test/query-tests/Security/CWE-079/Xss.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ nodes
174174
| tst.js:272:9:272:32 | loc3 |
175175
| tst.js:272:16:272:32 | document.location |
176176
| tst.js:275:7:275:10 | loc3 |
177+
| tst.js:277:22:277:29 | location |
177178
| winjs.js:2:7:2:53 | tainted |
178179
| winjs.js:2:17:2:33 | document.location |
179180
| winjs.js:2:17:2:40 | documen ... .search |
@@ -384,5 +385,6 @@ edges
384385
| tst.js:257:7:257:10 | name | tst.js:257:7:257:10 | name | tst.js:257:7:257:10 | name | Cross-site scripting vulnerability due to $@. | tst.js:257:7:257:10 | name | user-provided value |
385386
| tst.js:261:11:261:21 | window.name | tst.js:261:11:261:21 | window.name | tst.js:261:11:261:21 | window.name | Cross-site scripting vulnerability due to $@. | tst.js:261:11:261:21 | window.name | user-provided value |
386387
| tst.js:275:7:275:10 | loc3 | tst.js:272:16:272:32 | document.location | tst.js:275:7:275:10 | loc3 | Cross-site scripting vulnerability due to $@. | tst.js:272:16:272:32 | document.location | user-provided value |
388+
| tst.js:277:22:277:29 | location | tst.js:277:22:277:29 | location | tst.js:277:22:277:29 | location | Cross-site scripting vulnerability due to $@. | tst.js:277:22:277:29 | location | user-provided value |
387389
| winjs.js:3:43:3:49 | tainted | winjs.js:2:17:2:33 | document.location | winjs.js:3:43:3:49 | tainted | Cross-site scripting vulnerability due to $@. | winjs.js:2:17:2:33 | document.location | user-provided value |
388390
| winjs.js:4:43:4:49 | tainted | winjs.js:2:17:2:33 | document.location | winjs.js:4:43:4:49 | tainted | Cross-site scripting vulnerability due to $@. | winjs.js:2:17:2:33 | document.location | user-provided value |

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,4 +273,6 @@ function jqueryLocation() {
273273
$(loc1); // OK
274274
$(loc2); // OK
275275
$(loc3); // OK - but still flagged
276+
277+
$("body").append(location); // NOT OK
276278
}

0 commit comments

Comments
 (0)