Skip to content

Commit a14ebb7

Browse files
Fixes
1 parent fae4043 commit a14ebb7

File tree

8 files changed

+8
-6
lines changed

8 files changed

+8
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,5 +144,5 @@ predicate missingPinning(DataFlow::Node node, string domain) {
144144

145145
/** Gets the domain name from the given string literal */
146146
private string getDomain(CompileTimeConstantExpr expr) {
147-
result = expr.getStringValue().regexpCapture("(https?://)?([^/]*)/?", 2)
147+
result = expr.getStringValue().regexpCapture("(https?://)?([^/]*)(/.*)?", 2)
148148
}

java/ql/src/Security/CWE/CWE-295/AndroidMissingCertificatePinning.qhelp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
"qhelp.dtd">
44
<qhelp>
55
<overview>
6+
<p>
67
Certificate pinning is the practice of only trusting a specific set of SSL certificates, rather than those that the device trusts by default.
78
In Android applications, it is reccomended to use certificate pinning when communicating over the network,
89
in order to minimize the risk of machine-in-the-middle attacks from a comprimised CA.
10+
</p>
911
</overview>
1012

1113
<recommendation>
File renamed without changes.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Test extends InlineExpectationsTest {
99

1010
override predicate hasActualResult(Location loc, string el, string tag, string value) {
1111
exists(DataFlow::Node node |
12-
missingPinning(node) and
12+
missingPinning(node, _) and
1313
loc = node.getLocation() and
1414
el = node.toString() and
1515
value = "" and

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Test extends InlineExpectationsTest {
99

1010
override predicate hasActualResult(Location loc, string el, string tag, string value) {
1111
exists(DataFlow::Node node |
12-
missingPinning(node) and
12+
missingPinning(node, _) and
1313
loc = node.getLocation() and
1414
el = node.toString() and
1515
value = "" and

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Test extends InlineExpectationsTest {
99

1010
override predicate hasActualResult(Location loc, string el, string tag, string value) {
1111
exists(DataFlow::Node node |
12-
missingPinning(node) and
12+
missingPinning(node, _) and
1313
loc = node.getLocation() and
1414
el = node.toString() and
1515
value = "" and

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Test extends InlineExpectationsTest {
99

1010
override predicate hasActualResult(Location loc, string el, string tag, string value) {
1111
exists(DataFlow::Node node |
12-
missingPinning(node) and
12+
missingPinning(node, _) and
1313
loc = node.getLocation() and
1414
el = node.toString() and
1515
value = "" and

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Test extends InlineExpectationsTest {
99

1010
override predicate hasActualResult(Location loc, string el, string tag, string value) {
1111
exists(DataFlow::Node node |
12-
missingPinning(node) and
12+
missingPinning(node, _) and
1313
loc = node.getLocation() and
1414
el = node.toString() and
1515
value = "" and

0 commit comments

Comments
 (0)