Skip to content

Commit db1ed67

Browse files
committed
JS: Simplify config in PrototypePollutingFunction.ql.
1 parent e55130e commit db1ed67

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

javascript/ql/src/Security/CWE-915/PrototypePollutingFunction.ql

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -251,25 +251,19 @@ module PropNameTrackingConfig implements DataFlow::StateConfigSig {
251251
node = DataFlow::MakeStateBarrierGuard<FlowState, BarrierGuard>::getABarrierNode(state)
252252
}
253253

254-
predicate isAdditionalFlowStep(
255-
DataFlow::Node node1, FlowState state1, DataFlow::Node node2, FlowState state2
256-
) {
257-
exists(state1) and
258-
state2 = state1 and
259-
(
260-
// Step through `p -> x[p]`
261-
exists(DataFlow::PropRead read |
262-
node1 = read.getPropertyNameExpr().flow() and
263-
not read.(DynamicPropRead).hasDominatingAssignment() and
264-
node2 = read
265-
)
266-
or
267-
// Step through `x -> x[p]`
268-
exists(DynamicPropRead read |
269-
not read.hasDominatingAssignment() and
270-
node1 = read.getBase() and
271-
node2 = read
272-
)
254+
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
255+
// Step through `p -> x[p]`
256+
exists(DataFlow::PropRead read |
257+
node1 = read.getPropertyNameExpr().flow() and
258+
not read.(DynamicPropRead).hasDominatingAssignment() and
259+
node2 = read
260+
)
261+
or
262+
// Step through `x -> x[p]`
263+
exists(DynamicPropRead read |
264+
not read.hasDominatingAssignment() and
265+
node1 = read.getBase() and
266+
node2 = read
273267
)
274268
}
275269

0 commit comments

Comments
 (0)