Skip to content

Commit 27c8eb3

Browse files
committed
Swift: Fix URL-related FPs.
1 parent e59d7e0 commit 27c8eb3

File tree

4 files changed

+2
-5
lines changed

4 files changed

+2
-5
lines changed

swift/ql/lib/codeql/swift/security/SensitiveExprs.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class SensitivePrivateInfo extends SensitiveDataType, TPrivateInfo {
6969
* contain hashed or encrypted data, or are only a reference to data that is
7070
* actually stored elsewhere.
7171
*/
72-
private string regexpProbablySafe() { result = ".*(hash|crypt|file|path|invalid).*" }
72+
private string regexpProbablySafe() { result = ".*(hash|crypt|file|path|url|invalid).*" }
7373

7474
/**
7575
* A `VarDecl` that might be used to contain sensitive data.

swift/ql/test/query-tests/Security/CWE-311/CleartextTransmission.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ nodes
3838
| testSend.swift:61:27:61:27 | str3 | semmle.label | str3 |
3939
| testSend.swift:65:27:65:27 | license_key | semmle.label | license_key |
4040
| testSend.swift:66:27:66:30 | .mobileNumber | semmle.label | .mobileNumber |
41-
| testSend.swift:67:27:67:30 | .mobileUrl | semmle.label | .mobileUrl |
4241
| testSend.swift:68:27:68:30 | .mobilePlayer | semmle.label | .mobilePlayer |
4342
| testSend.swift:69:27:69:30 | .passwordFeatureEnabled | semmle.label | .passwordFeatureEnabled |
4443
| testURL.swift:13:22:13:54 | ... .+(_:_:) ... | semmle.label | ... .+(_:_:) ... |
@@ -60,7 +59,6 @@ subpaths
6059
| testSend.swift:61:27:61:27 | str3 | testSend.swift:54:17:54:17 | password | testSend.swift:61:27:61:27 | str3 | This operation transmits 'str3', which may contain unencrypted sensitive data from $@. | testSend.swift:54:17:54:17 | password | password |
6160
| testSend.swift:65:27:65:27 | license_key | testSend.swift:65:27:65:27 | license_key | testSend.swift:65:27:65:27 | license_key | This operation transmits 'license_key', which may contain unencrypted sensitive data from $@. | testSend.swift:65:27:65:27 | license_key | license_key |
6261
| testSend.swift:66:27:66:30 | .mobileNumber | testSend.swift:66:27:66:30 | .mobileNumber | testSend.swift:66:27:66:30 | .mobileNumber | This operation transmits '.mobileNumber', which may contain unencrypted sensitive data from $@. | testSend.swift:66:27:66:30 | .mobileNumber | .mobileNumber |
63-
| testSend.swift:67:27:67:30 | .mobileUrl | testSend.swift:67:27:67:30 | .mobileUrl | testSend.swift:67:27:67:30 | .mobileUrl | This operation transmits '.mobileUrl', which may contain unencrypted sensitive data from $@. | testSend.swift:67:27:67:30 | .mobileUrl | .mobileUrl |
6462
| testSend.swift:68:27:68:30 | .mobilePlayer | testSend.swift:68:27:68:30 | .mobilePlayer | testSend.swift:68:27:68:30 | .mobilePlayer | This operation transmits '.mobilePlayer', which may contain unencrypted sensitive data from $@. | testSend.swift:68:27:68:30 | .mobilePlayer | .mobilePlayer |
6563
| testSend.swift:69:27:69:30 | .passwordFeatureEnabled | testSend.swift:69:27:69:30 | .passwordFeatureEnabled | testSend.swift:69:27:69:30 | .passwordFeatureEnabled | This operation transmits '.passwordFeatureEnabled', which may contain unencrypted sensitive data from $@. | testSend.swift:69:27:69:30 | .passwordFeatureEnabled | .passwordFeatureEnabled |
6664
| testURL.swift:13:22:13:54 | ... .+(_:_:) ... | testURL.swift:13:54:13:54 | passwd | testURL.swift:13:22:13:54 | ... .+(_:_:) ... | This operation transmits '... .+(_:_:) ...', which may contain unencrypted sensitive data from $@. | testURL.swift:13:54:13:54 | passwd | passwd |

swift/ql/test/query-tests/Security/CWE-311/SensitiveExprs.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@
128128
| testSend.swift:57:27:57:27 | password | label:password, type:credential |
129129
| testSend.swift:65:27:65:27 | license_key | label:license_key, type:credential |
130130
| testSend.swift:66:27:66:30 | .mobileNumber | label:mobileNumber, type:private information |
131-
| testSend.swift:67:27:67:30 | .mobileUrl | label:mobileUrl, type:private information |
132131
| testSend.swift:68:27:68:30 | .mobilePlayer | label:mobilePlayer, type:private information |
133132
| testSend.swift:69:27:69:30 | .passwordFeatureEnabled | label:passwordFeatureEnabled, type:credential |
134133
| testURL.swift:13:54:13:54 | passwd | label:passwd, type:credential |

swift/ql/test/query-tests/Security/CWE-311/testSend.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func test2(password : String, license_key: String, ms: MyStruct, connection : NW
6464
connection.send(content: str6, completion: .idempotent) // GOOD (encrypted)
6565
connection.send(content: license_key, completion: .idempotent) // BAD
6666
connection.send(content: ms.mobileNumber, completion: .idempotent) // BAD
67-
connection.send(content: ms.mobileUrl, completion: .idempotent) // GOOD (not sensitive) [FALSE POSITIVE]
67+
connection.send(content: ms.mobileUrl, completion: .idempotent) // GOOD (not sensitive)
6868
connection.send(content: ms.mobilePlayer, completion: .idempotent) // GOOD (not sensitive) [FALSE POSITIVE]
6969
connection.send(content: ms.passwordFeatureEnabled, completion: .idempotent) // GOOD (not sensitive) [FALSE POSITIVE]
7070
}

0 commit comments

Comments
 (0)