Add SetDefaultConnectionFactoryMethod class

This commit is contained in:
Joe Farebrother
2022-12-08 15:24:32 +00:00
parent 0dea5daffe
commit 8de5efb28f
2 changed files with 9 additions and 4 deletions

View File

@@ -61,10 +61,8 @@ predicate trustedDomain(string domainName) {
*/
private predicate trustedSocketFactory(MethodAccess setSocketFactory, boolean default) {
exists(MethodAccess getSocketFactory, MethodAccess initSslContext |
exists(Method m | setSocketFactory.getMethod().getASourceOverriddenMethod*() = m |
default = true and
m.getDeclaringType() instanceof HttpsUrlConnection and
m.hasName("setDefaultSSLSocketFactory")
exists(Method m | setSocketFactory.getMethod() = m |
default = true and m instanceof SetDefaultConnectionFactoryMethod
or
default = false and m instanceof SetConnectionFactoryMethod
) and

View File

@@ -150,6 +150,13 @@ class SetConnectionFactoryMethod extends Method {
}
}
class SetDefaultConnectionFactoryMethod extends Method {
SetDefaultConnectionFactoryMethod() {
this.hasName("setDefaultSSLSocketFactory") and
this.getDeclaringType().getAnAncestor() instanceof HttpsUrlConnection
}
}
class SetHostnameVerifierMethod extends Method {
SetHostnameVerifierMethod() {
this.hasName("setHostnameVerifier") and