JS: Add: dataflow step for static method of groupBy from Map.

This commit is contained in:
Napalys
2024-11-20 13:34:11 +01:00
parent 6344f83e4b
commit 58faa2d71e
4 changed files with 27 additions and 5 deletions

View File

@@ -160,7 +160,22 @@ private module CollectionDataFlow {
exists(DataFlow::MethodCallNode call |
call = DataFlow::globalVarRef(["Map", "Object"]).getAMemberCall("groupBy") and
pred = call.getArgument(0) and
succ = call
(succ = call.getCallback(1).getParameter(0) or succ = call.getALocalUse())
)
}
}
/**
* A step for handling data flow and taint tracking for the groupBy method on iterable objects.
* Ensures propagation of taint and data flow through the groupBy operation.
*/
private class GroupByDataFlowStep extends PreCallGraphStep {
override predicate storeStep(DataFlow::Node pred, DataFlow::SourceNode succ, string prop) {
exists(DataFlow::MethodCallNode call |
call = DataFlow::globalVarRef("Map").getAMemberCall("groupBy") and
pred = call.getArgument(0) and
succ = call and
prop = mapValueUnknownKey()
)
}
}