Skip to content

Commit 51dfebf

Browse files
atorralbasmowton
andcommitted
Apply suggestions from code review
Co-authored-by: Chris Smowton <[email protected]>
1 parent b9859fe commit 51dfebf

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

java/ql/lib/semmle/code/java/frameworks/android/WebView.qll

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,12 @@ class ShouldOverrideUrlLoading extends Method {
8383
*/
8484
predicate isJSEnabled(Expr webview) {
8585
webview.getType().(RefType).getASupertype*() instanceof TypeWebView and
86-
exists(MethodAccess allowJs |
86+
exists(MethodAccess allowJs, MethodAccess settings |
8787
allowJs.getMethod() instanceof AllowJavaScriptMethod and
8888
allowJs.getArgument(0).(CompileTimeConstantExpr).getBooleanValue() = true and
89-
exists(MethodAccess settings |
90-
settings.getMethod() instanceof WebViewGetSettingsMethod and
91-
DataFlow::localExprFlow(settings, allowJs.getQualifier()) and
92-
DataFlow::localExprFlow(webview, settings.getQualifier())
93-
)
89+
settings.getMethod() instanceof WebViewGetSettingsMethod and
90+
DataFlow::localExprFlow(settings, allowJs.getQualifier()) and
91+
DataFlow::localExprFlow(webview, settings.getQualifier())
9492
)
9593
}
9694

@@ -99,14 +97,12 @@ predicate isJSEnabled(Expr webview) {
9997
* `setAllowFileAccessFromFileURLs` have been set to `true`.
10098
*/
10199
predicate isAllowFileAccessEnabled(Expr webview) {
102-
exists(MethodAccess allowFileAccess |
100+
exists(MethodAccess allowFileAccess, MethodAccess settings |
103101
allowFileAccess.getMethod() instanceof CrossOriginAccessMethod and
104102
allowFileAccess.getArgument(0).(CompileTimeConstantExpr).getBooleanValue() = true and
105-
exists(MethodAccess settings |
106-
settings.getMethod() instanceof WebViewGetSettingsMethod and
107-
DataFlow::localExprFlow(settings, allowFileAccess.getQualifier()) and
108-
DataFlow::localExprFlow(webview, settings.getQualifier())
109-
)
103+
settings.getMethod() instanceof WebViewGetSettingsMethod and
104+
DataFlow::localExprFlow(settings, allowFileAccess.getQualifier()) and
105+
DataFlow::localExprFlow(webview, settings.getQualifier())
110106
)
111107
}
112108

java/ql/lib/semmle/code/java/security/UnsafeAndroidAccess.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private Expr getUnderlyingExpr(Expr e) {
7777
}
7878

7979
/**
80-
* Holds if `WebViewLoadUrlMethod` is called on `webview`
80+
* Holds if a `WebViewLoadUrlMethod` is called on `webview`
8181
* with `urlArg` as its first argument.
8282
*/
8383
private predicate webViewLoadUrl(Argument urlArg, Expr webview) {

0 commit comments

Comments
 (0)