JS: Add: taint step for Object.groupBy function, fixed test cases from 8ae05d8be4

This commit is contained in:
Napalys
2024-11-18 12:58:07 +01:00
parent 8ae05d8be4
commit 213ce225e0
3 changed files with 3 additions and 2 deletions

View File

@@ -158,7 +158,7 @@ private module CollectionDataFlow {
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
call = DataFlow::globalVarRef(["Map", "Object"]).getAMemberCall("groupBy") and
pred = call.getArgument(0) and
succ = call
)

View File

@@ -245,6 +245,7 @@ typeInferenceMismatch
| 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) |
| tst.js:2:13:2:20 | source() | tst.js:74:10:74:34 | Object. ... 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 |

View File

@@ -71,5 +71,5 @@ function test() {
sink(Map.groupBy(x, z => z)); // NOT OK
sink(Custom.groupBy(x, z => z)); // OK
sink(Object.groupBy(x, z => z)); // NOT OK -- This should be marked via taint step, but it is not.
sink(Object.groupBy(x, z => z)); // NOT OK
}