mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
JS: Add: taint step for Map.groupBy function
This commit is contained in:
@@ -151,4 +151,17 @@ private module CollectionDataFlow {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A step for a call to `groupBy` on an iterable object.
|
||||
*/
|
||||
private class GroupByTaintStep extends TaintTracking::SharedTaintStep {
|
||||
override predicate heapStep(DataFlow::Node pred, DataFlow::Node succ) {
|
||||
exists(DataFlow::MethodCallNode call |
|
||||
call = DataFlow::globalVarRef("Map").getAMemberCall("groupBy") and
|
||||
pred = call.getArgument(0) and
|
||||
succ = call
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,6 +244,7 @@ typeInferenceMismatch
|
||||
| tst.js:2:13:2:20 | source() | tst.js:66:10:66:16 | xSorted |
|
||||
| tst.js:2:13:2:20 | source() | tst.js:68:10:68:23 | x.toReversed() |
|
||||
| tst.js:2:13:2:20 | source() | tst.js:70:10:70:18 | xReversed |
|
||||
| tst.js:2:13:2:20 | source() | tst.js:72:10:72:31 | Map.gro ... z => z) |
|
||||
| xml.js:5:18:5:25 | source() | xml.js:8:14:8:17 | text |
|
||||
| xml.js:12:17:12:24 | source() | xml.js:13:14:13:19 | result |
|
||||
| xml.js:23:18:23:25 | source() | xml.js:20:14:20:17 | attr |
|
||||
|
||||
@@ -69,6 +69,6 @@ function test() {
|
||||
const xReversed = x.toReversed();
|
||||
sink(xReversed) // NOT OK
|
||||
|
||||
sink(Map.groupBy(x, z => z)); // NOT OK -- This should be marked via taint step, but it is not.
|
||||
sink(Map.groupBy(x, z => z)); // NOT OK
|
||||
sink(Custom.groupBy(x, z => z)); // OK
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user