Skip to content

Commit 252b72b

Browse files
committed
Swift: Add some special cases to preserve (for now) result quality.
1 parent 245e8fb commit 252b72b

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ abstract class SensitiveDataType extends TSensitiveDataType {
2929
class SensitiveCredential extends SensitiveDataType, TCredential {
3030
override string toString() { result = "credential" }
3131

32-
override string getRegexp() { result = HeuristicNames::maybeSensitiveRegexp(_) }
32+
override string getRegexp() {
33+
result = HeuristicNames::maybeSensitiveRegexp(_) or
34+
result = "(?is).*(license.?key).*"
35+
}
3336
}
3437

3538
/**

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ nodes
3737
| testSend.swift:59:27:59:27 | str1 | semmle.label | str1 |
3838
| testSend.swift:60:27:60:27 | str2 | semmle.label | str2 |
3939
| testSend.swift:61:27:61:27 | str3 | semmle.label | str3 |
40+
| testSend.swift:65:27:65:27 | license_key | semmle.label | license_key |
4041
| testSend.swift:66:27:66:30 | .mobileNumber | semmle.label | .mobileNumber |
4142
| testURL.swift:13:22:13:54 | ... .+(_:_:) ... | semmle.label | ... .+(_:_:) ... |
4243
| testURL.swift:13:54:13:54 | passwd | semmle.label | passwd |
@@ -57,6 +58,7 @@ subpaths
5758
| testSend.swift:59:27:59:27 | str1 | testSend.swift:52:13:52:13 | password | testSend.swift:59:27:59:27 | str1 | This operation transmits 'str1', which may contain unencrypted sensitive data from $@. | testSend.swift:52:13:52:13 | password | password |
5859
| testSend.swift:60:27:60:27 | str2 | testSend.swift:53:13:53:13 | password | testSend.swift:60:27:60:27 | str2 | This operation transmits 'str2', which may contain unencrypted sensitive data from $@. | testSend.swift:53:13:53:13 | password | password |
5960
| 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 |
61+
| 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 |
6062
| 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 |
6163
| 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 |
6264
| testURL.swift:15:22:15:55 | ... .+(_:_:) ... | testURL.swift:15:55:15:55 | account_no | testURL.swift:15:22:15:55 | ... .+(_:_:) ... | This operation transmits '... .+(_:_:) ...', which may contain unencrypted sensitive data from $@. | testURL.swift:15:55:15:55 | account_no | account_no |

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
| testSend.swift:55:23:55:23 | password | label:password, type:credential |
130130
| testSend.swift:56:27:56:27 | password | label:password, type:credential |
131131
| testSend.swift:57:27:57:27 | password | label:password, type:credential |
132+
| testSend.swift:65:27:65:27 | license_key | label:license_key, type:credential |
132133
| testSend.swift:66:27:66:30 | .mobileNumber | label:mobileNumber, type:private information |
133134
| testSend.swift:69:27:69:30 | .passwordFeatureEnabled | label:passwordFeatureEnabled, type:credential |
134135
| testURL.swift:13:54:13:54 | passwd | label:passwd, type:credential |

0 commit comments

Comments
 (0)