@@ -28,14 +28,15 @@ string captureQualifierFlow(Callable api) {
2828}
2929
3030string captureFieldFlow ( Callable api ) {
31- exists ( FieldAccess fa , ReturnNodeExt postUpdate |
31+ exists ( FieldAccess fa , ReturnNodeExt returnNode |
3232 not ( fa .getField ( ) .isStatic ( ) and fa .getField ( ) .isFinal ( ) ) and
33- postUpdate .getEnclosingCallable ( ) = api and
33+ returnNode .getEnclosingCallable ( ) = api and
34+ fa .getCompilationUnit ( ) = api .getCompilationUnit ( ) and
3435 isRelevantType ( api .getReturnType ( ) ) and
3536 not api .getDeclaringType ( ) instanceof EnumType and
36- TaintTracking:: localTaint ( DataFlow:: exprNode ( fa ) , postUpdate )
37+ TaintTracking:: localTaint ( DataFlow:: exprNode ( fa ) , returnNode )
3738 |
38- result = asTaintModel ( api , "Argument[-1]" , asOutput ( api , postUpdate ) )
39+ result = asTaintModel ( api , "Argument[-1]" , asOutput ( api , returnNode ) )
3940 )
4041}
4142
@@ -59,7 +60,11 @@ class ParameterToFieldConfig extends TaintTracking::Configuration {
5960 }
6061
6162 override predicate isSink ( DataFlow:: Node sink ) {
62- exists ( FieldAssignment a | a .getSource ( ) = sink .asExpr ( ) )
63+ exists ( FieldAssignment a |
64+ a .getSource ( ) = sink .asExpr ( ) and
65+ a .getDest ( ) .( VarAccess ) .getVariable ( ) .getCompilationUnit ( ) =
66+ sink .getEnclosingCallable ( ) .getCompilationUnit ( )
67+ )
6368 }
6469}
6570
0 commit comments