Skip to content

Commit 3e7a819

Browse files
committed
Simplification
1 parent a47ef17 commit 3e7a819

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ private class UntrustedUrlConfig extends TaintTracking::Configuration {
110110
UntrustedUrlConfig() { this = "UntrustedUrlConfig" }
111111

112112
override predicate isSource(DataFlow::Node node) {
113-
exists(string d | trustedDomain(d)) and
113+
trustedDomain(_) and
114114
exists(string lit | lit = node.asExpr().(CompileTimeConstantExpr).getStringValue() |
115115
lit.matches("%://%") and // it's a URL
116116
not exists(string dom | trustedDomain(dom) and lit.matches("%" + dom + "%"))
@@ -125,8 +125,7 @@ predicate missingPinning(DataFlow::Node node, string domain) {
125125
isAndroid() and
126126
node instanceof MissingPinningSink and
127127
(
128-
not exists(string s | trustedDomain(s)) and
129-
domain = ""
128+
not trustedDomain(_) and domain = ""
130129
or
131130
exists(UntrustedUrlConfig conf, DataFlow::Node src |
132131
conf.hasFlow(src, node) and

java/ql/test/query-tests/security/CWE-295/AndroidMissingCertificatePinning/Test1/test.ql

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ class Test extends InlineExpectationsTest {
1313
loc = node.getLocation() and
1414
el = node.toString() and
1515
value = "" and
16-
(
17-
if exists(string x | trustedDomain(x))
18-
then tag = "hasUntrustedResult"
19-
else tag = "hasNoTrustedResult"
20-
)
16+
if trustedDomain(_) then tag = "hasUntrustedResult" else tag = "hasNoTrustedResult"
2117
)
2218
}
2319
}

0 commit comments

Comments
 (0)