Skip to content

Commit 8de5efb

Browse files
Add SetDefaultConnectionFactoryMethod class
1 parent 0dea5da commit 8de5efb

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,8 @@ predicate trustedDomain(string domainName) {
6161
*/
6262
private predicate trustedSocketFactory(MethodAccess setSocketFactory, boolean default) {
6363
exists(MethodAccess getSocketFactory, MethodAccess initSslContext |
64-
exists(Method m | setSocketFactory.getMethod().getASourceOverriddenMethod*() = m |
65-
default = true and
66-
m.getDeclaringType() instanceof HttpsUrlConnection and
67-
m.hasName("setDefaultSSLSocketFactory")
64+
exists(Method m | setSocketFactory.getMethod() = m |
65+
default = true and m instanceof SetDefaultConnectionFactoryMethod
6866
or
6967
default = false and m instanceof SetConnectionFactoryMethod
7068
) and

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ class SetConnectionFactoryMethod extends Method {
150150
}
151151
}
152152

153+
class SetDefaultConnectionFactoryMethod extends Method {
154+
SetDefaultConnectionFactoryMethod() {
155+
this.hasName("setDefaultSSLSocketFactory") and
156+
this.getDeclaringType().getAnAncestor() instanceof HttpsUrlConnection
157+
}
158+
}
159+
153160
class SetHostnameVerifierMethod extends Method {
154161
SetHostnameVerifierMethod() {
155162
this.hasName("setHostnameVerifier") and

0 commit comments

Comments
 (0)