Skip to content

Commit b4c84d3

Browse files
committed
Added taint step for toSpliced, handles test from a65f80e
1 parent a65f80e commit b4c84d3

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

javascript/ql/lib/semmle/javascript/Arrays.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ module ArrayTaintTracking {
8686
succ.(DataFlow::SourceNode).getAMethodCall("splice") = call
8787
or
8888
// `e = array.pop()`, `e = array.shift()`, or similar: if `array` is tainted, then so is `e`.
89-
call.(DataFlow::MethodCallNode).calls(pred, ["pop", "shift", "slice", "splice", "at"]) and
89+
call.(DataFlow::MethodCallNode).calls(pred, ["pop", "shift", "slice", "splice", "at", "toSpliced"]) and
9090
succ = call
9191
or
9292
// `e = Array.from(x)`: if `x` is tainted, then so is `e`.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ typeInferenceMismatch
234234
| tst.js:2:13:2:20 | source() | tst.js:51:10:51:31 | seriali ... ript(x) |
235235
| tst.js:2:13:2:20 | source() | tst.js:54:14:54:19 | unsafe |
236236
| tst.js:2:13:2:20 | source() | tst.js:61:10:61:20 | x.reverse() |
237+
| tst.js:2:13:2:20 | source() | tst.js:62:10:62:22 | x.toSpliced() |
237238
| xml.js:5:18:5:25 | source() | xml.js:8:14:8:17 | text |
238239
| xml.js:12:17:12:24 | source() | xml.js:13:14:13:19 | result |
239240
| xml.js:23:18:23:25 | source() | xml.js:20:14:20:17 | attr |

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,5 @@ function test() {
5959
tagged`foo ${"safe"} bar ${x} baz`;
6060

6161
sink(x.reverse()); // NOT OK
62-
sink(x.toSpliced()); // NOT OK -- Should be caught, but it is not
62+
sink(x.toSpliced()); // NOT OK
6363
}

0 commit comments

Comments
 (0)