add taint step through flatten libraries

This commit is contained in:
Erik Krogh Kristensen
2021-07-15 12:36:07 +02:00
parent 77f4d56cd9
commit d2c74480b9
4 changed files with 26 additions and 1 deletions

View File

@@ -389,4 +389,21 @@ private module ArrayLibraries {
)
}
}
/**
* A taint step through a call to `Array.prototype.flat` or a polyfill implementing array flattening.
*/
private class ArrayFlatStep extends TaintTracking::SharedTaintStep {
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
exists(DataFlow::CallNode call | succ = call |
call.(DataFlow::MethodCallNode).getMethodName() = "flat" and
pred = call.getReceiver()
or
call =
API::moduleImport(["array-flatten", "arr-flatten", "flatten", "array.prototype.flat"])
.getACall() and
pred = call.getAnArgument()
)
}
}
}