Skip to content

Commit df42e7c

Browse files
committed
JS: Add test showing lack of implicit reads for ArrayElement
1 parent 4e7bd9d commit df42e7c

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ legacyDataFlowDifference
3232
| object-bypass-sanitizer.js:35:29:35:36 | source() | object-bypass-sanitizer.js:28:10:28:30 | sanitiz ... bj).foo | only flow with OLD data flow library |
3333
| promise.js:12:20:12:27 | source() | promise.js:13:8:13:23 | resolver.promise | only flow with OLD data flow library |
3434
| sanitizer-guards.js:57:11:57:18 | source() | sanitizer-guards.js:64:8:64:8 | x | only flow with NEW data flow library |
35+
| use-use-after-implicit-read.js:7:17:7:24 | source() | use-use-after-implicit-read.js:8:10:8:17 | captured | only flow with OLD data flow library |
36+
| use-use-after-implicit-read.js:7:17:7:24 | source() | use-use-after-implicit-read.js:15:10:15:10 | x | only flow with NEW data flow library |
3537
consistencyIssue
3638
| library-tests/TaintTracking/nested-props.js:20 | expected an alert, but found none | NOT OK - but not found | Consistency |
3739
| library-tests/TaintTracking/stringification-read-steps.js:17 | expected an alert, but found none | NOT OK | Consistency |
@@ -289,6 +291,7 @@ flow
289291
| tst.js:2:13:2:20 | source() | tst.js:48:10:48:22 | new Buffer(x) |
290292
| tst.js:2:13:2:20 | source() | tst.js:51:10:51:31 | seriali ... ript(x) |
291293
| tst.js:2:13:2:20 | source() | tst.js:54:14:54:19 | unsafe |
294+
| use-use-after-implicit-read.js:7:17:7:24 | source() | use-use-after-implicit-read.js:15:10:15:10 | x |
292295
| xml.js:5:18:5:25 | source() | xml.js:8:14:8:17 | text |
293296
| xml.js:12:17:12:24 | source() | xml.js:13:14:13:19 | result |
294297
| xml.js:23:18:23:25 | source() | xml.js:20:14:20:17 | attr |

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ legacyDataFlowDifference
2424
| sanitizer-guards.js:57:11:57:18 | source() | sanitizer-guards.js:64:8:64:8 | x | only flow with NEW data flow library |
2525
| tst.js:2:13:2:20 | source() | tst.js:35:14:35:16 | ary | only flow with NEW data flow library |
2626
| tst.js:2:13:2:20 | source() | tst.js:41:14:41:16 | ary | only flow with NEW data flow library |
27+
| use-use-after-implicit-read.js:7:17:7:24 | source() | use-use-after-implicit-read.js:15:10:15:10 | x | only flow with NEW data flow library |
2728
flow
2829
| access-path-sanitizer.js:2:18:2:25 | source() | access-path-sanitizer.js:4:8:4:12 | obj.x |
2930
| advanced-callgraph.js:2:13:2:20 | source() | advanced-callgraph.js:6:22:6:22 | v |
@@ -181,3 +182,4 @@ flow
181182
| tst.js:2:13:2:20 | source() | tst.js:35:14:35:16 | ary |
182183
| tst.js:2:13:2:20 | source() | tst.js:41:14:41:16 | ary |
183184
| tst.js:2:13:2:20 | source() | tst.js:54:14:54:19 | unsafe |
185+
| use-use-after-implicit-read.js:7:17:7:24 | source() | use-use-after-implicit-read.js:15:10:15:10 | x |
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import 'dummy';
2+
3+
function f(x) {
4+
let captured;
5+
function inner() { captured; captured = "sdf"; }
6+
7+
captured = [source(), "safe", x];
8+
sink(captured); // NOT OK [INCONSISTENCY] - no implicit read of ArrayElement
9+
g.apply(undefined, captured); // with use-use flow the output of an implicit read might flow here
10+
11+
return captured;
12+
}
13+
14+
function g(x, y) {
15+
sink(x); // NOT OK
16+
sink(y); // OK
17+
}

0 commit comments

Comments
 (0)