Skip to content

Commit 7ca0996

Browse files
committed
add a taint-tracking tests for calls to tagged template strings
1 parent 9b65017 commit 7ca0996

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ typeInferenceMismatch
231231
| tst.js:2:13:2:20 | source() | tst.js:47:10:47:30 | Buffer. ... 'hex') |
232232
| tst.js:2:13:2:20 | source() | tst.js:48:10:48:22 | new Buffer(x) |
233233
| tst.js:2:13:2:20 | source() | tst.js:51:10:51:31 | seriali ... ript(x) |
234+
| tst.js:2:13:2:20 | source() | tst.js:54:14:54:19 | unsafe |
234235
| xml.js:5:18:5:25 | source() | xml.js:8:14:8:17 | text |
235236
| xml.js:12:17:12:24 | source() | xml.js:13:14:13:19 | result |
236237
| xml.js:23:18:23:25 | source() | xml.js:20:14:20:17 | attr |

javascript/ql/test/library-tests/TaintTracking/DataFlowTracking.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,4 @@
109109
| thisAssignments.js:4:17:4:24 | source() | thisAssignments.js:5:10:5:18 | obj.field |
110110
| thisAssignments.js:7:19:7:26 | source() | thisAssignments.js:8:10:8:20 | this.field2 |
111111
| tst.js:2:13:2:20 | source() | tst.js:4:10:4:10 | x |
112+
| tst.js:2:13:2:20 | source() | tst.js:54:14:54:19 | unsafe |

javascript/ql/test/library-tests/TaintTracking/tst.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,12 @@ function test() {
4949

5050
const serializeJavaScript = require("serialize-javascript");
5151
sink(serializeJavaScript(x)) // NOT OK
52+
53+
function tagged(strings, safe, unsafe) {
54+
sink(unsafe) // NOT OK
55+
sink(safe) // OK
56+
sink(strings) // OK
57+
}
58+
59+
tagged`foo ${"safe"} bar ${x} baz`;
5260
}

0 commit comments

Comments
 (0)