Skip to content

Commit 13b2b1f

Browse files
committed
Swift: Repair CleartextTransmission query.
1 parent 62aa5de commit 13b2b1f

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

swift/ql/src/queries/Security/CWE-311/CleartextTransmission.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Url extends Transmitted {
4646
Url() {
4747
// `string` arg in `URL.init` is a sink
4848
// (we assume here that the URL goes on to be used in a network operation)
49-
exists(ClassDecl c, AbstractFunctionDecl f, CallExpr call |
49+
exists(StructDecl c, AbstractFunctionDecl f, CallExpr call |
5050
c.getName() = "URL" and
5151
c.getAMember() = f and
5252
f.getName() = ["init(string:)", "init(string:relativeTo:)"] and

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ edges
55
| testSend.swift:47:13:47:25 | call to pad(_:) : | testSend.swift:54:27:54:27 | str3 |
66
| testSend.swift:47:17:47:17 | password : | testSend.swift:41:10:41:18 | data : |
77
| testSend.swift:47:17:47:17 | password : | testSend.swift:47:13:47:25 | call to pad(_:) : |
8+
| testURL.swift:13:54:13:54 | passwd : | testURL.swift:13:22:13:54 | ... .+(_:_:) ... |
9+
| testURL.swift:16:55:16:55 | credit_card_no : | testURL.swift:16:22:16:55 | ... .+(_:_:) ... |
810
nodes
911
| testSend.swift:29:19:29:19 | passwordPlain | semmle.label | passwordPlain |
1012
| testSend.swift:41:10:41:18 | data : | semmle.label | data : |
@@ -16,10 +18,18 @@ nodes
1618
| testSend.swift:52:27:52:27 | str1 | semmle.label | str1 |
1719
| testSend.swift:53:27:53:27 | str2 | semmle.label | str2 |
1820
| testSend.swift:54:27:54:27 | str3 | semmle.label | str3 |
21+
| testURL.swift:13:22:13:54 | ... .+(_:_:) ... | semmle.label | ... .+(_:_:) ... |
22+
| testURL.swift:13:54:13:54 | passwd : | semmle.label | passwd : |
23+
| testURL.swift:16:22:16:55 | ... .+(_:_:) ... | semmle.label | ... .+(_:_:) ... |
24+
| testURL.swift:16:55:16:55 | credit_card_no : | semmle.label | credit_card_no : |
25+
| testURL.swift:20:22:20:22 | passwd | semmle.label | passwd |
1926
subpaths
2027
| testSend.swift:47:17:47:17 | password : | testSend.swift:41:10:41:18 | data : | testSend.swift:41:45:41:45 | data : | testSend.swift:47:13:47:25 | call to pad(_:) : |
2128
#select
2229
| testSend.swift:29:19:29:19 | passwordPlain | testSend.swift:29:19:29:19 | passwordPlain | testSend.swift:29:19:29:19 | passwordPlain | This operation transmits 'passwordPlain', which may contain unencrypted sensitive data from $@. | testSend.swift:29:19:29:19 | passwordPlain | passwordPlain |
2330
| testSend.swift:52:27:52:27 | str1 | testSend.swift:45:13:45:13 | password : | testSend.swift:52:27:52:27 | str1 | This operation transmits 'str1', which may contain unencrypted sensitive data from $@. | testSend.swift:45:13:45:13 | password : | password |
2431
| testSend.swift:53:27:53:27 | str2 | testSend.swift:46:13:46:13 | password : | testSend.swift:53:27:53:27 | str2 | This operation transmits 'str2', which may contain unencrypted sensitive data from $@. | testSend.swift:46:13:46:13 | password : | password |
2532
| testSend.swift:54:27:54:27 | str3 | testSend.swift:47:17:47:17 | password : | testSend.swift:54:27:54:27 | str3 | This operation transmits 'str3', which may contain unencrypted sensitive data from $@. | testSend.swift:47:17:47:17 | password : | password |
33+
| 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 |
34+
| testURL.swift:16:22:16:55 | ... .+(_:_:) ... | testURL.swift:16:55:16:55 | credit_card_no : | testURL.swift:16:22:16:55 | ... .+(_:_:) ... | This operation transmits '... .+(_:_:) ...', which may contain unencrypted sensitive data from $@. | testURL.swift:16:55:16:55 | credit_card_no : | credit_card_no |
35+
| testURL.swift:20:22:20:22 | passwd | testURL.swift:20:22:20:22 | passwd | testURL.swift:20:22:20:22 | passwd | This operation transmits 'passwd', which may contain unencrypted sensitive data from $@. | testURL.swift:20:22:20:22 | passwd | passwd |

0 commit comments

Comments
 (0)