@@ -17,45 +17,44 @@ private class ResultReceiverSendCall extends MethodAccess {
1717 Expr getSentData ( ) { result = this .getArgument ( 1 ) }
1818}
1919
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 }
2222
23- override predicate isSource ( DataFlow:: Node node ) { node instanceof RemoteFlowSource }
24-
25- override predicate isSink ( DataFlow:: Node node ) {
23+ predicate isSink ( DataFlow:: Node node ) {
2624 node .asExpr ( ) = any ( ResultReceiverSendCall c ) .getReceiver ( )
2725 }
2826}
2927
28+ private module UntrustedResultReceiverFlow = TaintTracking:: Global< UntrustedResultReceiverConfig > ;
29+
3030private 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 ( ) ) )
3232}
3333
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 }
3836
39- override predicate isSink ( DataFlow:: Node node ) {
37+ predicate isSink ( DataFlow:: Node node ) {
4038 exists ( ResultReceiverSendCall call |
4139 untrustedResultReceiverSend ( _, call ) and
4240 node .asExpr ( ) = call .getSentData ( )
4341 )
4442 }
4543
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 ) }
5145}
5246
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+ */
5452predicate sensitiveResultReceiver (
55- DataFlow:: PathNode src , DataFlow:: PathNode sink , DataFlow:: Node recSrc
53+ SensitiveResultReceiverFlow:: PathNode src , SensitiveResultReceiverFlow:: PathNode sink ,
54+ DataFlow:: Node recSrc
5655) {
57- exists ( ResultReceiverSendCall call , SensitiveResultReceiverConf conf |
58- conf . hasFlowPath ( src , sink ) and
56+ exists ( ResultReceiverSendCall call |
57+ SensitiveResultReceiverFlow :: flowPath ( src , sink ) and
5958 sink .getNode ( ) .asExpr ( ) = call .getSentData ( ) and
6059 untrustedResultReceiverSend ( recSrc , call )
6160 )
0 commit comments