Skip to content

Commit dd83c17

Browse files
Use more precise control flow logic
1 parent e9f9e68 commit dd83c17

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ class OnReceivedSslErrorMethod extends Method {
1414
Parameter handlerArg() { result = this.getParameter(1) }
1515
}
1616

17-
/** A call to `SslErrorHandler.cancel` */
18-
private class SslCancelCall extends MethodAccess {
19-
SslCancelCall() {
20-
this.getMethod().hasQualifiedName("android.webkit", "SslErrorHandler", "cancel")
21-
}
22-
}
23-
2417
/** A call to `SslErrorHandler.proceed` */
2518
private class SslProceedCall extends MethodAccess {
2619
SslProceedCall() {
@@ -30,6 +23,7 @@ private class SslProceedCall extends MethodAccess {
3023

3124
/** Holds if `m` trusts all certificates by calling `SslErrorHandler.proceed` unconditionally. */
3225
predicate trustsAllCerts(OnReceivedSslErrorMethod m) {
33-
exists(SslProceedCall pr | pr.getQualifier().(VarAccess).getVariable() = m.handlerArg()) and
34-
not exists(SslCancelCall ca | ca.getQualifier().(VarAccess).getVariable() = m.handlerArg())
26+
exists(SslProceedCall pr | pr.getQualifier().(VarAccess).getVariable() = m.handlerArg() |
27+
pr.getBasicBlock().bbPostDominates(m.getBody().getBasicBlock())
28+
)
3529
}

0 commit comments

Comments
 (0)