@@ -580,16 +580,16 @@ module TaintTracking {
580
580
*/
581
581
private class ComputedPropWriteTaintStep extends SharedTaintStep {
582
582
override predicate heapStep ( DataFlow:: Node pred , DataFlow:: Node succ ) {
583
- exists ( AssignExpr assgn , IndexExpr idx , DataFlow:: SourceNode obj |
584
- assgn .getTarget ( ) = idx and
585
- obj . flowsToExpr ( idx . getBase ( ) ) and
586
- not exists ( idx . getPropertyName ( ) ) and
587
- pred = DataFlow :: valueNode ( assgn . getRhs ( ) ) and
583
+ exists ( DataFlow :: PropWrite assgn , DataFlow:: SourceNode obj |
584
+ not exists ( assgn .getPropertyName ( ) ) and
585
+ not assgn . getWriteNode ( ) instanceof Property and // not a write inside an object literal
586
+ pred = assgn . getRhs ( ) and
587
+ assgn = obj . getAPropertyWrite ( ) and
588
588
succ = obj
589
589
|
590
590
obj instanceof DataFlow:: ObjectLiteralNode
591
591
or
592
- obj .getAPropertyRead ( "length" ) .flowsToExpr ( idx .getPropertyNameExpr ( ) )
592
+ obj .getAPropertyRead ( "length" ) .flowsToExpr ( assgn .getPropertyNameExpr ( ) )
593
593
)
594
594
}
595
595
}
@@ -614,8 +614,8 @@ module TaintTracking {
614
614
override predicate stringManipulationStep ( DataFlow:: Node pred , DataFlow:: Node target ) {
615
615
exists ( DataFlow:: ValueNode succ | target = succ |
616
616
// string operations that propagate taint
617
- exists ( string name | name = succ .getAstNode ( ) . ( MethodCallExpr ) .getMethodName ( ) |
618
- pred . asExpr ( ) = succ .getAstNode ( ) . ( MethodCallExpr ) .getReceiver ( ) and
617
+ exists ( string name | name = succ .( DataFlow :: MethodCallNode ) .getMethodName ( ) |
618
+ pred = succ .( DataFlow :: MethodCallNode ) .getReceiver ( ) and
619
619
(
620
620
// sorted, interesting, properties of String.prototype
621
621
name =
@@ -634,7 +634,7 @@ module TaintTracking {
634
634
name = "join"
635
635
)
636
636
or
637
- exists ( int i | pred . asExpr ( ) = succ .getAstNode ( ) . ( MethodCallExpr ) .getArgument ( i ) |
637
+ exists ( int i | pred = succ .( DataFlow :: MethodCallNode ) .getArgument ( i ) |
638
638
name = "concat"
639
639
or
640
640
name = [ "replace" , "replaceAll" ] and i = 1
@@ -649,10 +649,10 @@ module TaintTracking {
649
649
)
650
650
or
651
651
// String.fromCharCode and String.fromCodePoint
652
- exists ( int i , MethodCallExpr mce |
653
- mce = succ . getAstNode ( ) and
654
- pred . asExpr ( ) = mce .getArgument ( i ) and
655
- ( mce .getMethodName ( ) = "fromCharCode" or mce . getMethodName ( ) = "fromCodePoint" )
652
+ exists ( int i , DataFlow :: MethodCallNode mcn |
653
+ mcn = succ and
654
+ pred = mcn .getArgument ( i ) and
655
+ mcn .getMethodName ( ) = [ "fromCharCode" , "fromCodePoint" ]
656
656
)
657
657
or
658
658
// `(encode|decode)URI(Component)?` propagate taint
@@ -778,11 +778,11 @@ module TaintTracking {
778
778
* the parameters in `input`.
779
779
*/
780
780
predicate isUrlSearchParams ( DataFlow:: SourceNode params , DataFlow:: Node input ) {
781
- exists ( DataFlow:: GlobalVarRefNode urlSearchParams , NewExpr newUrlSearchParams |
781
+ exists ( DataFlow:: GlobalVarRefNode urlSearchParams , DataFlow :: NewNode newUrlSearchParams |
782
782
urlSearchParams .getName ( ) = "URLSearchParams" and
783
- newUrlSearchParams = urlSearchParams .getAnInstantiation ( ) . asExpr ( ) and
784
- params . asExpr ( ) = newUrlSearchParams and
785
- input . asExpr ( ) = newUrlSearchParams .getArgument ( 0 )
783
+ newUrlSearchParams = urlSearchParams .getAnInstantiation ( ) and
784
+ params = newUrlSearchParams and
785
+ input = newUrlSearchParams .getArgument ( 0 )
786
786
)
787
787
}
788
788
0 commit comments