-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
General issue - JavaScript data flow analysis #5177
Comments
@github/codeql-javascript might have some input here. |
I would say it's an uncovered scenario. In private class ArrayCreationStep extends PreCallGraphStep {
override predicate storeStep(DataFlow::Node element, DataFlow::SourceNode obj, string prop) {
exists(DataFlow::ArrayCreationNode arr, int i |
element = arr.getElement(i) and
obj = arr and
if arr = any(PromiseAllCreation c).getArrayNode()
then prop = arrayElement(i)
else prop = arrayElement()
)
}
} However, this might introduce false positives if an array contain elements of different types. But it's something I think is worth investigating. |
This issue is stale because it has been open 14 days with no activity. Comment or remove the |
I've now merged the above suggestion as part of another PR. |
Description of the issue
The following DOM XSS vector is recognized nicely (CWE-079):
But this one is not recognized:
Is this a limitation of the JS data flow analysis library, generic limitation of the methodology or just an uncovered scenario (e.g. not propagating taint through array literals to their elements?)
My original test case was more complicated and a bit more realistic (like I could imagine similar code to be written IRL):
But this didn't work so I started to simplify. Same for a forEach + arrow function.
The text was updated successfully, but these errors were encountered: