@@ -17,45 +17,44 @@ private class ResultReceiverSendCall extends MethodAccess {
17
17
Expr getSentData ( ) { result = this .getArgument ( 1 ) }
18
18
}
19
19
20
- private class UntrustedResultReceiverConf extends TaintTracking2 :: Configuration {
21
- UntrustedResultReceiverConf ( ) { this = "UntrustedResultReceiverConf" }
20
+ private module UntrustedResultReceiverConfig implements DataFlow :: ConfigSig {
21
+ predicate isSource ( DataFlow :: Node node ) { node instanceof RemoteFlowSource }
22
22
23
- override predicate isSource ( DataFlow:: Node node ) { node instanceof RemoteFlowSource }
24
-
25
- override predicate isSink ( DataFlow:: Node node ) {
23
+ predicate isSink ( DataFlow:: Node node ) {
26
24
node .asExpr ( ) = any ( ResultReceiverSendCall c ) .getReceiver ( )
27
25
}
28
26
}
29
27
28
+ private module UntrustedResultReceiverFlow = TaintTracking:: Global< UntrustedResultReceiverConfig > ;
29
+
30
30
private predicate untrustedResultReceiverSend ( DataFlow:: Node src , ResultReceiverSendCall call ) {
31
- any ( UntrustedResultReceiverConf c ) . hasFlow ( src , DataFlow:: exprNode ( call .getReceiver ( ) ) )
31
+ UntrustedResultReceiverFlow :: flow ( src , DataFlow:: exprNode ( call .getReceiver ( ) ) )
32
32
}
33
33
34
- private class SensitiveResultReceiverConf extends TaintTracking:: Configuration {
35
- SensitiveResultReceiverConf ( ) { this = "SensitiveResultReceiverConf" }
36
-
37
- override predicate isSource ( DataFlow:: Node node ) { node .asExpr ( ) instanceof SensitiveExpr }
34
+ private module SensitiveResultReceiverConfig implements DataFlow:: ConfigSig {
35
+ predicate isSource ( DataFlow:: Node node ) { node .asExpr ( ) instanceof SensitiveExpr }
38
36
39
- override predicate isSink ( DataFlow:: Node node ) {
37
+ predicate isSink ( DataFlow:: Node node ) {
40
38
exists ( ResultReceiverSendCall call |
41
39
untrustedResultReceiverSend ( _, call ) and
42
40
node .asExpr ( ) = call .getSentData ( )
43
41
)
44
42
}
45
43
46
- override predicate allowImplicitRead ( DataFlow:: Node node , DataFlow:: ContentSet c ) {
47
- super .allowImplicitRead ( node , c )
48
- or
49
- this .isSink ( node )
50
- }
44
+ predicate allowImplicitRead ( DataFlow:: Node node , DataFlow:: ContentSet c ) { isSink ( node ) }
51
45
}
52
46
53
- /** Holds if there is a path from sensitive data at `src` to a result receiver at `sink`, and the receiver was obtained from an untrusted source `recSrc`. */
47
+ module SensitiveResultReceiverFlow = TaintTracking:: Global< SensitiveResultReceiverConfig > ;
48
+
49
+ /**
50
+ * Holds if there is a path from sensitive data at `src` to a result receiver at `sink`, and the receiver was obtained from an untrusted source `recSrc`.
51
+ */
54
52
predicate sensitiveResultReceiver (
55
- DataFlow:: PathNode src , DataFlow:: PathNode sink , DataFlow:: Node recSrc
53
+ SensitiveResultReceiverFlow:: PathNode src , SensitiveResultReceiverFlow:: PathNode sink ,
54
+ DataFlow:: Node recSrc
56
55
) {
57
- exists ( ResultReceiverSendCall call , SensitiveResultReceiverConf conf |
58
- conf . hasFlowPath ( src , sink ) and
56
+ exists ( ResultReceiverSendCall call |
57
+ SensitiveResultReceiverFlow :: flowPath ( src , sink ) and
59
58
sink .getNode ( ) .asExpr ( ) = call .getSentData ( ) and
60
59
untrustedResultReceiverSend ( recSrc , call )
61
60
)
0 commit comments