Skip to content

Commit 213ce22

Browse files
committed
JS: Add: taint step for Object.groupBy function, fixed test cases from 8ae05d8
1 parent 8ae05d8 commit 213ce22

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

javascript/ql/lib/semmle/javascript/Collections.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ private module CollectionDataFlow {
158158
private class GroupByTaintStep extends TaintTracking::SharedTaintStep {
159159
override predicate heapStep(DataFlow::Node pred, DataFlow::Node succ) {
160160
exists(DataFlow::MethodCallNode call |
161-
call = DataFlow::globalVarRef("Map").getAMemberCall("groupBy") and
161+
call = DataFlow::globalVarRef(["Map", "Object"]).getAMemberCall("groupBy") and
162162
pred = call.getArgument(0) and
163163
succ = call
164164
)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ typeInferenceMismatch
245245
| tst.js:2:13:2:20 | source() | tst.js:68:10:68:23 | x.toReversed() |
246246
| tst.js:2:13:2:20 | source() | tst.js:70:10:70:18 | xReversed |
247247
| tst.js:2:13:2:20 | source() | tst.js:72:10:72:31 | Map.gro ... z => z) |
248+
| tst.js:2:13:2:20 | source() | tst.js:74:10:74:34 | Object. ... z => z) |
248249
| xml.js:5:18:5:25 | source() | xml.js:8:14:8:17 | text |
249250
| xml.js:12:17:12:24 | source() | xml.js:13:14:13:19 | result |
250251
| 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
@@ -71,5 +71,5 @@ function test() {
7171

7272
sink(Map.groupBy(x, z => z)); // NOT OK
7373
sink(Custom.groupBy(x, z => z)); // OK
74-
sink(Object.groupBy(x, z => z)); // NOT OK -- This should be marked via taint step, but it is not.
74+
sink(Object.groupBy(x, z => z)); // NOT OK
7575
}

0 commit comments

Comments
 (0)