Skip to content

Commit 38ef07c

Browse files
committed
JS: Fix join ordering
1 parent b5f3d77 commit 38ef07c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

javascript/ql/src/Security/CWE-400/PrototypePollutionUtility.ql

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ abstract class EnumeratedPropName extends DataFlow::Node {
4848
*/
4949
abstract DataFlow::Node getSourceObject();
5050

51+
/**
52+
* Gets a source node that refers to the object whose properties are being enumerated.
53+
*/
54+
DataFlow::SourceNode getASourceObjectRef() {
55+
result = AccessPath::getAnAliasedSourceNode(getSourceObject())
56+
}
57+
5158
/**
5259
* Gets a property read that accesses the corresponding property value in the source object.
5360
*
@@ -56,7 +63,7 @@ abstract class EnumeratedPropName extends DataFlow::Node {
5663
SourceNode getASourceProp() {
5764
exists(Node base, Node key |
5865
dynamicPropReadStep(base, key, result) and
59-
AccessPath::getAnAliasedSourceNode(getSourceObject()).flowsTo(base) and
66+
getASourceObjectRef().flowsTo(base) and
6067
key.getImmediatePredecessor*() = this
6168
)
6269
}
@@ -117,7 +124,7 @@ class EntriesEnumeratedPropName extends EnumeratedPropName {
117124
* Holds if the properties of `node` are enumerated locally.
118125
*/
119126
predicate arePropertiesEnumerated(DataFlow::SourceNode node) {
120-
node = AccessPath::getAnAliasedSourceNode(any(EnumeratedPropName name).getSourceObject())
127+
node = any(EnumeratedPropName name).getASourceObjectRef()
121128
}
122129

123130
/**

0 commit comments

Comments
 (0)