Swift: Add more test cases for swift/cleartext-transmission.

This commit is contained in:
Geoffrey White
2024-08-05 18:56:17 +01:00
parent c0a69f197d
commit 345e1840f2
3 changed files with 79 additions and 0 deletions

View File

@@ -32,6 +32,17 @@ edges
| testURL.swift:105:19:105:53 | call to String.init(data:encoding:) | testURL.swift:106:20:106:20 | "..." | provenance | |
| testURL.swift:105:19:105:53 | call to String.init(data:encoding:) [some:0] | testURL.swift:105:6:105:10 | let ...? [some:0] | provenance | |
| testURL.swift:105:32:105:32 | data | testURL.swift:105:19:105:53 | call to String.init(data:encoding:) [some:0] | provenance | |
| testURL.swift:116:52:116:52 | email | testURL.swift:116:18:116:18 | "..." | provenance | |
| testURL.swift:117:28:117:28 | email | testURL.swift:117:18:117:18 | "..." | provenance | |
| testURL.swift:118:53:118:53 | secret_key | testURL.swift:118:18:118:18 | "..." | provenance | |
| testURL.swift:119:60:119:60 | email | testURL.swift:119:18:119:18 | "..." | provenance | |
| testURL.swift:123:52:123:52 | phone_number | testURL.swift:123:18:123:18 | "..." | provenance | |
| testURL.swift:124:25:124:25 | phone_number | testURL.swift:124:18:124:18 | "..." | provenance | |
| testURL.swift:125:31:125:31 | phone_number | testURL.swift:125:18:125:18 | "..." | provenance | |
| testURL.swift:126:28:126:28 | phone_number | testURL.swift:126:18:126:18 | "..." | provenance | |
| testURL.swift:127:25:127:25 | phone_number | testURL.swift:127:18:127:18 | "..." | provenance | |
| testURL.swift:131:37:131:37 | account_no | testURL.swift:131:18:131:18 | "..." | provenance | |
| testURL.swift:132:39:132:39 | account_no | testURL.swift:132:18:132:18 | "..." | provenance | |
nodes
| file://:0:0:0:0 | .value | semmle.label | .value |
| file://:0:0:0:0 | self | semmle.label | self |
@@ -90,6 +101,28 @@ nodes
| testURL.swift:105:19:105:53 | call to String.init(data:encoding:) [some:0] | semmle.label | call to String.init(data:encoding:) [some:0] |
| testURL.swift:105:32:105:32 | data | semmle.label | data |
| testURL.swift:106:20:106:20 | "..." | semmle.label | "..." |
| testURL.swift:116:18:116:18 | "..." | semmle.label | "..." |
| testURL.swift:116:52:116:52 | email | semmle.label | email |
| testURL.swift:117:18:117:18 | "..." | semmle.label | "..." |
| testURL.swift:117:28:117:28 | email | semmle.label | email |
| testURL.swift:118:18:118:18 | "..." | semmle.label | "..." |
| testURL.swift:118:53:118:53 | secret_key | semmle.label | secret_key |
| testURL.swift:119:18:119:18 | "..." | semmle.label | "..." |
| testURL.swift:119:60:119:60 | email | semmle.label | email |
| testURL.swift:123:18:123:18 | "..." | semmle.label | "..." |
| testURL.swift:123:52:123:52 | phone_number | semmle.label | phone_number |
| testURL.swift:124:18:124:18 | "..." | semmle.label | "..." |
| testURL.swift:124:25:124:25 | phone_number | semmle.label | phone_number |
| testURL.swift:125:18:125:18 | "..." | semmle.label | "..." |
| testURL.swift:125:31:125:31 | phone_number | semmle.label | phone_number |
| testURL.swift:126:18:126:18 | "..." | semmle.label | "..." |
| testURL.swift:126:28:126:28 | phone_number | semmle.label | phone_number |
| testURL.swift:127:18:127:18 | "..." | semmle.label | "..." |
| testURL.swift:127:25:127:25 | phone_number | semmle.label | phone_number |
| testURL.swift:131:18:131:18 | "..." | semmle.label | "..." |
| testURL.swift:131:37:131:37 | account_no | semmle.label | account_no |
| testURL.swift:132:18:132:18 | "..." | semmle.label | "..." |
| testURL.swift:132:39:132:39 | account_no | semmle.label | account_no |
subpaths
| testSend.swift:60:17:60:17 | password | testSend.swift:41:10:41:18 | data | testSend.swift:41:45:41:45 | data | testSend.swift:60:13:60:25 | call to pad(_:) |
| testSend.swift:94:27:94:30 | .password | testSend.swift:86:7:86:7 | self | file://:0:0:0:0 | .value | testSend.swift:94:27:94:39 | .value |
@@ -121,3 +154,14 @@ subpaths
| testURL.swift:75:18:75:69 | ... .+(_:_:) ... | testURL.swift:75:53:75:69 | call to get_cert_string() | testURL.swift:75:18:75:69 | ... .+(_:_:) ... | This operation transmits '... .+(_:_:) ...', which may contain unencrypted sensitive data from $@. | testURL.swift:75:53:75:69 | call to get_cert_string() | call to get_cert_string() |
| testURL.swift:96:18:96:18 | "..." | testURL.swift:96:51:96:51 | certificate | testURL.swift:96:18:96:18 | "..." | This operation transmits '"..."', which may contain unencrypted sensitive data from $@. | testURL.swift:96:51:96:51 | certificate | certificate |
| testURL.swift:106:20:106:20 | "..." | testURL.swift:104:16:104:57 | call to SecKeyCopyExternalRepresentation(_:_:) | testURL.swift:106:20:106:20 | "..." | This operation transmits '"..."', which may contain unencrypted sensitive data from $@. | testURL.swift:104:16:104:57 | call to SecKeyCopyExternalRepresentation(_:_:) | call to SecKeyCopyExternalRepresentation(_:_:) |
| testURL.swift:116:18:116:18 | "..." | testURL.swift:116:52:116:52 | email | testURL.swift:116:18:116:18 | "..." | This operation transmits '"..."', which may contain unencrypted sensitive data from $@. | testURL.swift:116:52:116:52 | email | email |
| testURL.swift:117:18:117:18 | "..." | testURL.swift:117:28:117:28 | email | testURL.swift:117:18:117:18 | "..." | This operation transmits '"..."', which may contain unencrypted sensitive data from $@. | testURL.swift:117:28:117:28 | email | email |
| testURL.swift:118:18:118:18 | "..." | testURL.swift:118:53:118:53 | secret_key | testURL.swift:118:18:118:18 | "..." | This operation transmits '"..."', which may contain unencrypted sensitive data from $@. | testURL.swift:118:53:118:53 | secret_key | secret_key |
| testURL.swift:119:18:119:18 | "..." | testURL.swift:119:60:119:60 | email | testURL.swift:119:18:119:18 | "..." | This operation transmits '"..."', which may contain unencrypted sensitive data from $@. | testURL.swift:119:60:119:60 | email | email |
| testURL.swift:123:18:123:18 | "..." | testURL.swift:123:52:123:52 | phone_number | testURL.swift:123:18:123:18 | "..." | This operation transmits '"..."', which may contain unencrypted sensitive data from $@. | testURL.swift:123:52:123:52 | phone_number | phone_number |
| testURL.swift:124:18:124:18 | "..." | testURL.swift:124:25:124:25 | phone_number | testURL.swift:124:18:124:18 | "..." | This operation transmits '"..."', which may contain unencrypted sensitive data from $@. | testURL.swift:124:25:124:25 | phone_number | phone_number |
| testURL.swift:125:18:125:18 | "..." | testURL.swift:125:31:125:31 | phone_number | testURL.swift:125:18:125:18 | "..." | This operation transmits '"..."', which may contain unencrypted sensitive data from $@. | testURL.swift:125:31:125:31 | phone_number | phone_number |
| testURL.swift:126:18:126:18 | "..." | testURL.swift:126:28:126:28 | phone_number | testURL.swift:126:18:126:18 | "..." | This operation transmits '"..."', which may contain unencrypted sensitive data from $@. | testURL.swift:126:28:126:28 | phone_number | phone_number |
| testURL.swift:127:18:127:18 | "..." | testURL.swift:127:25:127:25 | phone_number | testURL.swift:127:18:127:18 | "..." | This operation transmits '"..."', which may contain unencrypted sensitive data from $@. | testURL.swift:127:25:127:25 | phone_number | phone_number |
| testURL.swift:131:18:131:18 | "..." | testURL.swift:131:37:131:37 | account_no | testURL.swift:131:18:131:18 | "..." | This operation transmits '"..."', which may contain unencrypted sensitive data from $@. | testURL.swift:131:37:131:37 | account_no | account_no |
| testURL.swift:132:18:132:18 | "..." | testURL.swift:132:39:132:39 | account_no | testURL.swift:132:18:132:18 | "..." | This operation transmits '"..."', which may contain unencrypted sensitive data from $@. | testURL.swift:132:39:132:39 | account_no | account_no |

View File

@@ -182,3 +182,14 @@
| testURL.swift:75:53:75:69 | call to get_cert_string() | label:get_cert_string, type:credential |
| testURL.swift:96:51:96:51 | certificate | label:certificate, type:credential |
| testURL.swift:104:16:104:57 | call to SecKeyCopyExternalRepresentation(_:_:) | label:password, type:password |
| testURL.swift:116:52:116:52 | email | label:email, type:private information |
| testURL.swift:117:28:117:28 | email | label:email, type:private information |
| testURL.swift:118:53:118:53 | secret_key | label:secret_key, type:credential |
| testURL.swift:119:60:119:60 | email | label:email, type:private information |
| testURL.swift:123:52:123:52 | phone_number | label:phone_number, type:private information |
| testURL.swift:124:25:124:25 | phone_number | label:phone_number, type:private information |
| testURL.swift:125:31:125:31 | phone_number | label:phone_number, type:private information |
| testURL.swift:126:28:126:28 | phone_number | label:phone_number, type:private information |
| testURL.swift:127:25:127:25 | phone_number | label:phone_number, type:private information |
| testURL.swift:131:37:131:37 | account_no | label:account_no, type:private information |
| testURL.swift:132:39:132:39 | account_no | label:account_no, type:private information |

View File

@@ -107,3 +107,27 @@ func test4(key: SecKey) {
}
}
}
func test5() {
// variant URL types...
let email = get_string()
let secret_key = get_string()
_ = URL(string: "http://example.com/login?email=\(email)"); // BAD
_ = URL(string: "mailto:\(email)"); // GOOD (revealing your e-amil address in an e-mail is expected) [FALSE POSITIVE]
_ = URL(string: "mailto:info@example.com?subject=\(secret_key)"); // BAD
_ = URL(string: "mailto:info@example.com?subject=foo&cc=\(email)"); // GOOD [FALSE POSITIVE]
let phone_number = get_string()
_ = URL(string: "http://example.com/profile?tel=\(phone_number)"); // BAD
_ = URL(string: "tel:\(phone_number)") // GOOD [FALSE POSITIVE]
_ = URL(string: "telprompt:\(phone_number)") // GOOD [FALSE POSITIVE]
_ = URL(string: "callto:\(phone_number)") // GOOD [FALSE POSITIVE]
_ = URL(string: "sms:\(phone_number)") // GOOD [FALSE POSITIVE]
let account_no = get_string()
_ = URL(string: "file:///foo/bar/\(account_no).csv") // GOOD (local, so not transmitted) [FALSE POSITIVE]
_ = URL(string: "ftp://example.com/\(account_no).csv") // BAD
}