@@ -106,29 +106,29 @@ private class MissingPinningSink extends DataFlow::Node {
106
106
}
107
107
108
108
/** Configuration for finding uses of non trusted URLs. */
109
- private class UntrustedUrlConfig extends TaintTracking:: Configuration {
110
- UntrustedUrlConfig ( ) { this = "UntrustedUrlConfig" }
111
-
112
- override predicate isSource ( DataFlow:: Node node ) {
109
+ private module UntrustedUrlConfig implements DataFlow:: ConfigSig {
110
+ predicate isSource ( DataFlow:: Node node ) {
113
111
trustedDomain ( _) and
114
112
exists ( string lit | lit = node .asExpr ( ) .( CompileTimeConstantExpr ) .getStringValue ( ) |
115
113
lit .matches ( "%://%" ) and // it's a URL
116
114
not exists ( string dom | trustedDomain ( dom ) and lit .matches ( "%" + dom + "%" ) )
117
115
)
118
116
}
119
117
120
- override predicate isSink ( DataFlow:: Node node ) { node instanceof MissingPinningSink }
118
+ predicate isSink ( DataFlow:: Node node ) { node instanceof MissingPinningSink }
121
119
}
122
120
121
+ private module UntrustedUrlFlow = TaintTracking:: Make< UntrustedUrlConfig > ;
122
+
123
123
/** Holds if `node` is a network communication call for which certificate pinning is not implemented. */
124
124
predicate missingPinning ( DataFlow:: Node node , string domain ) {
125
125
isAndroid ( ) and
126
126
node instanceof MissingPinningSink and
127
127
(
128
128
not trustedDomain ( _) and domain = ""
129
129
or
130
- exists ( UntrustedUrlConfig conf , DataFlow:: Node src |
131
- conf . hasFlow ( src , node ) and
130
+ exists ( DataFlow:: Node src |
131
+ UntrustedUrlFlow :: hasFlow ( src , node ) and
132
132
domain = getDomain ( src .asExpr ( ) )
133
133
)
134
134
)
0 commit comments