mirror of
https://github.com/github/codeql.git
synced 2026-04-27 09:45:15 +02:00
JS: Add: dataflow step for find, findLast, findLastIndex callback functions
This commit is contained in:
@@ -483,4 +483,18 @@ private module ArrayLibraries {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a data flow step that tracks the flow of data through callback functions in arrays.
|
||||
*/
|
||||
private class ArrayCallBackDataFlowStep extends PreCallGraphStep {
|
||||
override predicate loadStep(DataFlow::Node obj, DataFlow::Node element, string prop) {
|
||||
exists(DataFlow::MethodCallNode call |
|
||||
call.getMethodName() = ["findLast", "find", "findLastIndex"] and
|
||||
prop = arrayLikeElement() and
|
||||
obj = call.getReceiver() and
|
||||
element = call.getCallback(0).getParameter(0)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user