@@ -8,6 +8,7 @@ import javascript
88
99module LoopBoundInjection {
1010 import semmle.javascript.security.TaintedObject
11+ import semmle.javascript.security.CommonFlowState
1112
1213 /**
1314 * Holds if an exception will be thrown whenever `e` evaluates to `undefined` or `null`.
@@ -176,16 +177,16 @@ module LoopBoundInjection {
176177 predicate blocksExpr ( boolean outcome , Expr e ) { none ( ) }
177178
178179 /**
179- * Holds if this node acts as a barrier for `label `, blocking further flow from `e` if `this` evaluates to `outcome`.
180+ * Holds if this node acts as a barrier for `state `, blocking further flow from `e` if `this` evaluates to `outcome`.
180181 */
181- predicate blocksExpr ( boolean outcome , Expr e , DataFlow :: FlowLabel label ) { none ( ) }
182+ predicate blocksExpr ( boolean outcome , Expr e , FlowState state ) { none ( ) }
182183
183184 /** DEPRECATED. Use `blocksExpr` instead. */
184185 deprecated predicate sanitizes ( boolean outcome , Expr e ) { this .blocksExpr ( outcome , e ) }
185186
186187 /** DEPRECATED. Use `blocksExpr` instead. */
187188 deprecated predicate sanitizes ( boolean outcome , Expr e , DataFlow:: FlowLabel label ) {
188- this .blocksExpr ( outcome , e , label )
189+ this .blocksExpr ( outcome , e , FlowState :: fromFlowLabel ( label ) )
189190 }
190191 }
191192
@@ -214,10 +215,10 @@ module LoopBoundInjection {
214215
215216 IsArraySanitizerGuard ( ) { astNode .getCalleeName ( ) = "isArray" }
216217
217- override predicate blocksExpr ( boolean outcome , Expr e , DataFlow :: FlowLabel label ) {
218+ override predicate blocksExpr ( boolean outcome , Expr e , FlowState state ) {
218219 true = outcome and
219220 e = astNode .getAnArgument ( ) and
220- label = TaintedObject :: label ( )
221+ state . isTaintedObject ( )
221222 }
222223 }
223224
@@ -232,10 +233,10 @@ module LoopBoundInjection {
232233 DataFlow:: globalVarRef ( "Array" ) .flowsToExpr ( astNode .getRightOperand ( ) )
233234 }
234235
235- override predicate blocksExpr ( boolean outcome , Expr e , DataFlow :: FlowLabel label ) {
236+ override predicate blocksExpr ( boolean outcome , Expr e , FlowState state ) {
236237 true = outcome and
237238 e = astNode .getLeftOperand ( ) and
238- label = TaintedObject :: label ( )
239+ state . isTaintedObject ( )
239240 }
240241 }
241242
@@ -253,10 +254,10 @@ module LoopBoundInjection {
253254 propRead .getPropertyName ( ) = "length"
254255 }
255256
256- override predicate blocksExpr ( boolean outcome , Expr e , DataFlow :: FlowLabel label ) {
257+ override predicate blocksExpr ( boolean outcome , Expr e , FlowState state ) {
257258 false = outcome and
258259 e = propRead .getBase ( ) .asExpr ( ) and
259- label = TaintedObject :: label ( )
260+ state . isTaintedObject ( )
260261 }
261262 }
262263}
0 commit comments