Skip to content

Commit 1d345c6

Browse files
Refactoring and simplification
Co-authored-by: Tony Torralba <[email protected]>
1 parent 9ef319f commit 1d345c6

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

java/ql/src/Security/CWE/CWE-200/AndroidWebViewSettingsPermitsContentAccess.ql

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ private class TypeWebViewOrSubclass extends RefType {
2525
*/
2626
private class PrivateGetterMethodAccess extends MethodAccess {
2727
PrivateGetterMethodAccess() {
28-
this instanceof MethodAccess and
2928
this.getMethod() instanceof GetterMethod and
3029
this.getMethod().isPrivate()
3130
}
@@ -34,7 +33,7 @@ private class PrivateGetterMethodAccess extends MethodAccess {
3433
/** A source for `android.webkit.WebView` objects. */
3534
class WebViewSource extends DataFlow::Node {
3635
WebViewSource() {
37-
this.getType().(RefType) instanceof TypeWebViewOrSubclass and
36+
this.getType() instanceof TypeWebViewOrSubclass and
3837
// To reduce duplicate results, we only consider WebView objects from
3938
// constructor and method calls, or method accesses which are cast to WebView.
4039
(
@@ -56,16 +55,15 @@ class WebSettingsDisallowContentAccessSink extends DataFlow::Node {
5655
exists(MethodAccess ma |
5756
ma.getQualifier() = this.asExpr() and
5857
ma.getMethod() instanceof AllowContentAccessMethod and
59-
ma.getArgument(0).(BooleanLiteral).getBooleanValue() = false
58+
ma.getArgument(0).(CompileTimeConstantExpr).getBooleanValue() = false
6059
)
6160
}
6261
}
6362

6463
class WebViewDisallowContentAccessConfiguration extends TaintTracking::Configuration {
6564
WebViewDisallowContentAccessConfiguration() { this = "WebViewDisallowContentAccessConfiguration" }
6665

67-
override predicate isSource(DataFlow::Node node, DataFlow::FlowState state) {
68-
state instanceof DataFlow::FlowStateEmpty and
66+
override predicate isSource(DataFlow::Node node) {
6967
node instanceof WebViewSource
7068
}
7169

0 commit comments

Comments
 (0)