Skip to content

Commit ca145f2

Browse files
committed
JS: Add test showing why parameter-sinks wont actually work well in JS
1 parent 3bcfca4 commit ca145f2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

javascript/ql/test/library-tests/frameworks/data/paramDecorator.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ class C {
88
}
99
decoratedParamSink(@testlib.ParamDecoratorSink x) { // NOT OK - though slightly weird alert location
1010
}
11+
decoratedParamSink2(@testlib.ParamDecoratorSink x) { // OK
12+
x.push(source());
13+
}
1114
}
1215

1316
new C().decoratedParamSink(source());
17+
new C().decoratedParamSink2([]);

javascript/ql/test/library-tests/frameworks/data/test.expected

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
consistencyIssue
2+
| library-tests/frameworks/data/paramDecorator.ts:11 | did not expect an alert, but found an alert for BasicTaintTracking | OK | |
23
taintFlow
34
| paramDecorator.ts:6:54:6:54 | x | paramDecorator.ts:7:10:7:10 | x |
4-
| paramDecorator.ts:13:28:13:35 | source() | paramDecorator.ts:9:50:9:50 | x |
5+
| paramDecorator.ts:12:12:12:19 | source() | paramDecorator.ts:11:51:11:51 | x |
6+
| paramDecorator.ts:16:28:16:35 | source() | paramDecorator.ts:9:50:9:50 | x |
57
| test.js:5:30:5:37 | source() | test.js:5:8:5:38 | testlib ... urce()) |
68
| test.js:6:22:6:29 | source() | test.js:6:8:6:30 | preserv ... urce()) |
79
| test.js:7:41:7:48 | source() | test.js:7:8:7:49 | require ... urce()) |
@@ -58,6 +60,7 @@ taintFlow
5860
| test.js:203:32:203:39 | source() | test.js:203:32:203:39 | source() |
5961
isSink
6062
| paramDecorator.ts:9:50:9:50 | x | test-sink |
63+
| paramDecorator.ts:11:51:11:51 | x | test-sink |
6164
| test.js:54:18:54:25 | source() | test-sink |
6265
| test.js:55:22:55:29 | source() | test-sink |
6366
| test.js:57:24:57:31 | source() | test-sink |

0 commit comments

Comments
 (0)