@@ -61,10 +61,16 @@ class WebSettingsDisallowContentAccessSink extends DataFlow::Node {
61
61
}
62
62
}
63
63
64
- class WebViewDisallowContentAccessConfiguration extends TaintTracking:: Configuration {
65
- WebViewDisallowContentAccessConfiguration ( ) { this = "WebViewDisallowContentAccessConfiguration" }
64
+ private newtype WebViewOrSettings =
65
+ IsWebView ( ) or
66
+ IsSettings ( )
66
67
67
- override predicate isSource ( DataFlow:: Node node ) { node instanceof WebViewSource }
68
+ private module WebViewDisallowContentAccessConfiguration implements DataFlow:: StateConfigSig {
69
+ class FlowState = WebViewOrSettings ;
70
+
71
+ predicate isSource ( DataFlow:: Node node , FlowState state ) {
72
+ node instanceof WebViewSource and state instanceof IsWebView
73
+ }
68
74
69
75
/**
70
76
* Holds if the step from `node1` to `node2` is a dataflow step that gets the `WebSettings` object
@@ -73,12 +79,11 @@ class WebViewDisallowContentAccessConfiguration extends TaintTracking::Configura
73
79
* This step is only valid when `state1` is empty and `state2` indicates that the `WebSettings` object
74
80
* has been accessed.
75
81
*/
76
- override predicate isAdditionalTaintStep (
77
- DataFlow:: Node node1 , DataFlow:: FlowState state1 , DataFlow:: Node node2 ,
78
- DataFlow:: FlowState state2
82
+ predicate isAdditionalFlowStep (
83
+ DataFlow:: Node node1 , FlowState state1 , DataFlow:: Node node2 , FlowState state2
79
84
) {
80
- state1 instanceof DataFlow :: FlowStateEmpty and
81
- state2 = "WebSettings" and
85
+ state1 instanceof IsWebView and
86
+ state2 instanceof IsSettings and
82
87
// settings = webView.getSettings()
83
88
// ^node2 = ^node1
84
89
exists ( MethodAccess ma |
@@ -88,12 +93,17 @@ class WebViewDisallowContentAccessConfiguration extends TaintTracking::Configura
88
93
)
89
94
}
90
95
91
- override predicate isSink ( DataFlow:: Node node , DataFlow :: FlowState state ) {
92
- state = "WebSettings" and
96
+ predicate isSink ( DataFlow:: Node node , FlowState state ) {
97
+ state instanceof IsSettings and
93
98
node instanceof WebSettingsDisallowContentAccessSink
94
99
}
100
+
101
+ predicate isBarrier ( DataFlow:: Node node , FlowState state ) { none ( ) }
95
102
}
96
103
104
+ module WebViewDisallowContentAccessFlow =
105
+ TaintTracking:: MakeWithState< WebViewDisallowContentAccessConfiguration > ;
106
+
97
107
from Expr e
98
108
where
99
109
// explicit: setAllowContentAccess(true)
@@ -106,7 +116,7 @@ where
106
116
// implicit: no setAllowContentAccess(false)
107
117
exists ( WebViewSource source |
108
118
source .asExpr ( ) = e and
109
- not any ( WebViewDisallowContentAccessConfiguration cfg ) . hasFlow ( source , _)
119
+ not WebViewDisallowContentAccessFlow :: hasFlow ( source , _)
110
120
)
111
121
select e ,
112
122
"Sensitive information may be exposed via a malicious link due to access to content:// links being allowed in this WebView."
0 commit comments