mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
fix FP in js/path-injection by recognizing more prefix checks
This commit is contained in:
@@ -47,25 +47,13 @@ abstract class EnumeratedPropName extends DataFlow::Node {
|
||||
*/
|
||||
abstract DataFlow::Node getSourceObject();
|
||||
|
||||
/**
|
||||
* Gets a local reference of the source object.
|
||||
*/
|
||||
SourceNode getASourceObjectRef() {
|
||||
exists(SourceNode root, string path |
|
||||
getSourceObject() = AccessPath::getAReferenceTo(root, path) and
|
||||
result = AccessPath::getAReferenceTo(root, path)
|
||||
)
|
||||
or
|
||||
result = getSourceObject().getALocalSource()
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a property read that accesses the corresponding property value in the source object.
|
||||
*
|
||||
* For example, gets `src[key]` in `for (var key in src) { src[key]; }`.
|
||||
*/
|
||||
PropRead getASourceProp() {
|
||||
result = getASourceObjectRef().getAPropertyRead() and
|
||||
result = AccessPath::getASourceAccess(getSourceObject()).getAPropertyRead() and
|
||||
result.getPropertyNameExpr().flow().getImmediatePredecessor*() = this
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user