JS: Add: Array.protype.findLast as taint step

This commit is contained in:
Napalys
2024-11-15 14:09:44 +01:00
parent ea90698fc1
commit fcb65534a8
5 changed files with 166 additions and 131 deletions

View File

@@ -384,13 +384,16 @@ private module ArrayLibraries {
}
/**
* Gets a call to `Array.prototype.find` or a polyfill implementing the same functionality.
* Gets a call to `Array.prototype.find` or `Array.prototype.findLast` or a polyfill implementing the same functionality.
*/
DataFlow::CallNode arrayFindCall(DataFlow::Node array) {
result.(DataFlow::MethodCallNode).getMethodName() = "find" and
result.(DataFlow::MethodCallNode).getMethodName() in ["find", "findLast"] and
array = result.getReceiver()
or
result = DataFlow::moduleImport(["array.prototype.find", "array-find"]).getACall() and
result =
DataFlow::moduleImport([
"array.prototype.find", "array-find", "array.prototype.findLast", "array-find-last"
]).getACall() and
array = result.getArgument(0)
}