@@ -546,16 +546,16 @@ module TaintTracking {
546
546
*/
547
547
private class ComputedPropWriteTaintStep extends SharedTaintStep {
548
548
override predicate heapStep ( DataFlow:: Node pred , DataFlow:: Node succ ) {
549
- exists ( AssignExpr assgn , IndexExpr idx , DataFlow:: SourceNode obj |
550
- assgn .getTarget ( ) = idx and
551
- obj . flowsToExpr ( idx . getBase ( ) ) and
552
- not exists ( idx . getPropertyName ( ) ) and
553
- pred = DataFlow :: valueNode ( assgn . getRhs ( ) ) and
549
+ exists ( DataFlow :: PropWrite assgn , DataFlow:: SourceNode obj |
550
+ not exists ( assgn .getPropertyName ( ) ) and
551
+ not assgn . getWriteNode ( ) instanceof Property and // not a write inside an object literal
552
+ pred = assgn . getRhs ( ) and
553
+ assgn = obj . getAPropertyWrite ( ) and
554
554
succ = obj
555
555
|
556
556
obj instanceof DataFlow:: ObjectLiteralNode
557
557
or
558
- obj .getAPropertyRead ( "length" ) .flowsToExpr ( idx .getPropertyNameExpr ( ) )
558
+ obj .getAPropertyRead ( "length" ) .flowsToExpr ( assgn .getPropertyNameExpr ( ) )
559
559
)
560
560
}
561
561
}
@@ -580,8 +580,8 @@ module TaintTracking {
580
580
override predicate stringManipulationStep ( DataFlow:: Node pred , DataFlow:: Node target ) {
581
581
exists ( DataFlow:: ValueNode succ | target = succ |
582
582
// string operations that propagate taint
583
- exists ( string name | name = succ .getAstNode ( ) . ( MethodCallExpr ) .getMethodName ( ) |
584
- pred . asExpr ( ) = succ .getAstNode ( ) . ( MethodCallExpr ) .getReceiver ( ) and
583
+ exists ( string name | name = succ .( DataFlow :: MethodCallNode ) .getMethodName ( ) |
584
+ pred = succ .( DataFlow :: MethodCallNode ) .getReceiver ( ) and
585
585
(
586
586
// sorted, interesting, properties of String.prototype
587
587
name =
@@ -600,7 +600,7 @@ module TaintTracking {
600
600
name = "join"
601
601
)
602
602
or
603
- exists ( int i | pred . asExpr ( ) = succ .getAstNode ( ) . ( MethodCallExpr ) .getArgument ( i ) |
603
+ exists ( int i | pred = succ .( DataFlow :: MethodCallNode ) .getArgument ( i ) |
604
604
name = "concat"
605
605
or
606
606
name = [ "replace" , "replaceAll" ] and i = 1
@@ -615,10 +615,10 @@ module TaintTracking {
615
615
)
616
616
or
617
617
// String.fromCharCode and String.fromCodePoint
618
- exists ( int i , MethodCallExpr mce |
619
- mce = succ . getAstNode ( ) and
620
- pred . asExpr ( ) = mce .getArgument ( i ) and
621
- ( mce .getMethodName ( ) = "fromCharCode" or mce . getMethodName ( ) = "fromCodePoint" )
618
+ exists ( int i , DataFlow :: MethodCallNode mcn |
619
+ mcn = succ and
620
+ pred = mcn .getArgument ( i ) and
621
+ mcn .getMethodName ( ) = [ "fromCharCode" , "fromCodePoint" ]
622
622
)
623
623
or
624
624
// `(encode|decode)URI(Component)?` propagate taint
@@ -744,11 +744,11 @@ module TaintTracking {
744
744
* the parameters in `input`.
745
745
*/
746
746
predicate isUrlSearchParams ( DataFlow:: SourceNode params , DataFlow:: Node input ) {
747
- exists ( DataFlow:: GlobalVarRefNode urlSearchParams , NewExpr newUrlSearchParams |
747
+ exists ( DataFlow:: GlobalVarRefNode urlSearchParams , DataFlow :: NewNode newUrlSearchParams |
748
748
urlSearchParams .getName ( ) = "URLSearchParams" and
749
- newUrlSearchParams = urlSearchParams .getAnInstantiation ( ) . asExpr ( ) and
750
- params . asExpr ( ) = newUrlSearchParams and
751
- input . asExpr ( ) = newUrlSearchParams .getArgument ( 0 )
749
+ newUrlSearchParams = urlSearchParams .getAnInstantiation ( ) and
750
+ params = newUrlSearchParams and
751
+ input = newUrlSearchParams .getArgument ( 0 )
752
752
)
753
753
}
754
754
0 commit comments