Skip to content

Commit ce10698

Browse files
committed
add tests
1 parent e7d8cd8 commit ce10698

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,14 @@ nodes
347347
| tst.js:354:16:354:39 | documen ... .search |
348348
| tst.js:355:12:355:17 | target |
349349
| tst.js:355:12:355:17 | target |
350+
| tst.js:361:10:361:42 | target |
351+
| tst.js:361:19:361:35 | document.location |
352+
| tst.js:361:19:361:35 | document.location |
353+
| tst.js:361:19:361:42 | documen ... .search |
354+
| tst.js:362:16:362:21 | target |
355+
| tst.js:362:16:362:21 | target |
356+
| tst.js:366:21:366:26 | target |
357+
| tst.js:366:21:366:26 | target |
350358
| typeahead.js:20:13:20:45 | target |
351359
| typeahead.js:20:22:20:38 | document.location |
352360
| typeahead.js:20:22:20:38 | document.location |
@@ -670,6 +678,13 @@ edges
670678
| tst.js:354:16:354:32 | document.location | tst.js:354:16:354:39 | documen ... .search |
671679
| tst.js:354:16:354:32 | document.location | tst.js:354:16:354:39 | documen ... .search |
672680
| tst.js:354:16:354:39 | documen ... .search | tst.js:354:7:354:39 | target |
681+
| tst.js:361:10:361:42 | target | tst.js:362:16:362:21 | target |
682+
| tst.js:361:10:361:42 | target | tst.js:362:16:362:21 | target |
683+
| tst.js:361:10:361:42 | target | tst.js:366:21:366:26 | target |
684+
| tst.js:361:10:361:42 | target | tst.js:366:21:366:26 | target |
685+
| tst.js:361:19:361:35 | document.location | tst.js:361:19:361:42 | documen ... .search |
686+
| tst.js:361:19:361:35 | document.location | tst.js:361:19:361:42 | documen ... .search |
687+
| tst.js:361:19:361:42 | documen ... .search | tst.js:361:10:361:42 | target |
673688
| typeahead.js:20:13:20:45 | target | typeahead.js:21:12:21:17 | target |
674689
| typeahead.js:20:22:20:38 | document.location | typeahead.js:20:22:20:45 | documen ... .search |
675690
| typeahead.js:20:22:20:38 | document.location | typeahead.js:20:22:20:45 | documen ... .search |
@@ -772,6 +787,8 @@ edges
772787
| tst.js:336:18:336:35 | params.get('name') | tst.js:330:18:330:34 | document.location | tst.js:336:18:336:35 | params.get('name') | Cross-site scripting vulnerability due to $@. | tst.js:330:18:330:34 | document.location | user-provided value |
773788
| tst.js:349:5:349:30 | getUrl( ... ring(1) | tst.js:347:20:347:36 | document.location | tst.js:349:5:349:30 | getUrl( ... ring(1) | Cross-site scripting vulnerability due to $@. | tst.js:347:20:347:36 | document.location | user-provided value |
774789
| tst.js:355:12:355:17 | target | tst.js:354:16:354:32 | document.location | tst.js:355:12:355:17 | target | Cross-site scripting vulnerability due to $@. | tst.js:354:16:354:32 | document.location | user-provided value |
790+
| tst.js:362:16:362:21 | target | tst.js:361:19:361:35 | document.location | tst.js:362:16:362:21 | target | Cross-site scripting vulnerability due to $@. | tst.js:361:19:361:35 | document.location | user-provided value |
791+
| tst.js:366:21:366:26 | target | tst.js:361:19:361:35 | document.location | tst.js:366:21:366:26 | target | Cross-site scripting vulnerability due to $@. | tst.js:361:19:361:35 | document.location | user-provided value |
775792
| typeahead.js:25:18:25:20 | val | typeahead.js:20:22:20:38 | document.location | typeahead.js:25:18:25:20 | val | Cross-site scripting vulnerability due to $@. | typeahead.js:20:22:20:38 | document.location | user-provided value |
776793
| v-html.vue:2:8:2:23 | v-html=tainted | v-html.vue:6:42:6:58 | document.location | v-html.vue:2:8:2:23 | v-html=tainted | Cross-site scripting vulnerability due to $@. | v-html.vue:6:42:6:58 | document.location | user-provided value |
777794
| 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 |

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,14 @@ nodes
347347
| tst.js:354:16:354:39 | documen ... .search |
348348
| tst.js:355:12:355:17 | target |
349349
| tst.js:355:12:355:17 | target |
350+
| tst.js:361:10:361:42 | target |
351+
| tst.js:361:19:361:35 | document.location |
352+
| tst.js:361:19:361:35 | document.location |
353+
| tst.js:361:19:361:42 | documen ... .search |
354+
| tst.js:362:16:362:21 | target |
355+
| tst.js:362:16:362:21 | target |
356+
| tst.js:366:21:366:26 | target |
357+
| tst.js:366:21:366:26 | target |
350358
| typeahead.js:9:28:9:30 | loc |
351359
| typeahead.js:9:28:9:30 | loc |
352360
| typeahead.js:10:16:10:18 | loc |
@@ -674,6 +682,13 @@ edges
674682
| tst.js:354:16:354:32 | document.location | tst.js:354:16:354:39 | documen ... .search |
675683
| tst.js:354:16:354:32 | document.location | tst.js:354:16:354:39 | documen ... .search |
676684
| tst.js:354:16:354:39 | documen ... .search | tst.js:354:7:354:39 | target |
685+
| tst.js:361:10:361:42 | target | tst.js:362:16:362:21 | target |
686+
| tst.js:361:10:361:42 | target | tst.js:362:16:362:21 | target |
687+
| tst.js:361:10:361:42 | target | tst.js:366:21:366:26 | target |
688+
| tst.js:361:10:361:42 | target | tst.js:366:21:366:26 | target |
689+
| tst.js:361:19:361:35 | document.location | tst.js:361:19:361:42 | documen ... .search |
690+
| tst.js:361:19:361:35 | document.location | tst.js:361:19:361:42 | documen ... .search |
691+
| tst.js:361:19:361:42 | documen ... .search | tst.js:361:10:361:42 | target |
677692
| typeahead.js:9:28:9:30 | loc | typeahead.js:10:16:10:18 | loc |
678693
| typeahead.js:9:28:9:30 | loc | typeahead.js:10:16:10:18 | loc |
679694
| typeahead.js:9:28:9:30 | loc | typeahead.js:10:16:10:18 | loc |

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,3 +355,18 @@ function growl() {
355355
$.jGrowl(target); // NOT OK
356356
}
357357

358+
function thisNodes() {
359+
var pluginName = "myFancyJQueryPlugin";
360+
var myPlugin = function () {
361+
var target = document.location.search
362+
this.html(target); // NOT OK. (this is a jQuery object)
363+
this.innerHTML = target // OK. (this is a jQuery object)
364+
365+
this.each(function () {
366+
this.innerHTML = target; // NOT OK. (this is a DOM-node);
367+
this.html(target); // OK. (this is a DOM-node);
368+
});
369+
}
370+
$.fn[pluginName] = myPlugin;
371+
372+
}

0 commit comments

Comments
 (0)