Skip to content

Commit 8245e6c

Browse files
committed
Swift: Fix unwanted flows.
1 parent e589b1f commit 8245e6c

File tree

3 files changed

+2
-94
lines changed

3 files changed

+2
-94
lines changed

swift/ql/lib/codeql/swift/frameworks/StandardLibrary/Collection.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ private class CollectionSummaries extends SummaryModelCsv {
3232
";Collection;true;dropLast(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
3333
";Collection;true;flatMap(_:);;;Argument[-1];ReturnValue;taint",
3434
";Collection;true;flatMap(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
35-
";Collection;true;map(_:);;;Argument[-1];ReturnValue;taint",
36-
";Collection;true;map(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
35+
//";Collection;true;map(_:);;;Argument[-1];ReturnValue;taint", --- disabled due to dubious results in practice
36+
//";Collection;true;map(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value", --- disabled due to dubious results in practice
3737
";Collection;true;split(maxSplits:omittingEmptySubsequences:whereSeparator:);;;Argument[-1];ReturnValue;taint",
3838
";Collection;true;split(separator:maxSplits:omittingEmptySubsequences:);;;Argument[-1];ReturnValue;taint",
3939
";Collection;true;removeFirst();;;Argument[-1];ReturnValue;taint",

swift/ql/test/query-tests/Security/CWE-259/ConstantPassword.expected

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,4 @@
11
edges
2-
| rncryptor.swift:60:9:60:65 | call to String.init(_:) | rncryptor.swift:68:25:68:44 | call to getARandomPassword() | provenance | |
3-
| rncryptor.swift:60:9:60:65 | call to String.init(_:) [Collection element] | rncryptor.swift:68:25:68:44 | call to getARandomPassword() [Collection element] | provenance | |
4-
| rncryptor.swift:60:16:60:16 | ............ | rncryptor.swift:60:16:60:64 | call to map(_:) | provenance | |
5-
| rncryptor.swift:60:16:60:64 | call to map(_:) | rncryptor.swift:60:9:60:65 | call to String.init(_:) | provenance | |
6-
| rncryptor.swift:60:16:60:64 | call to map(_:) | rncryptor.swift:60:9:60:65 | call to String.init(_:) [Collection element] | provenance | |
7-
| rncryptor.swift:68:25:68:44 | call to getARandomPassword() | rncryptor.swift:74:89:74:89 | myRandomPassword | provenance | |
8-
| rncryptor.swift:68:25:68:44 | call to getARandomPassword() | rncryptor.swift:75:56:75:56 | myRandomPassword | provenance | |
9-
| rncryptor.swift:68:25:68:44 | call to getARandomPassword() | rncryptor.swift:80:89:80:89 | myMaybePassword | provenance | |
10-
| rncryptor.swift:68:25:68:44 | call to getARandomPassword() | rncryptor.swift:81:56:81:56 | myMaybePassword | provenance | |
11-
| rncryptor.swift:68:25:68:44 | call to getARandomPassword() [Collection element] | rncryptor.swift:74:89:74:89 | myRandomPassword | provenance | |
12-
| rncryptor.swift:68:25:68:44 | call to getARandomPassword() [Collection element] | rncryptor.swift:75:56:75:56 | myRandomPassword | provenance | |
13-
| rncryptor.swift:68:25:68:44 | call to getARandomPassword() [Collection element] | rncryptor.swift:80:89:80:89 | myMaybePassword | provenance | |
14-
| rncryptor.swift:68:25:68:44 | call to getARandomPassword() [Collection element] | rncryptor.swift:81:56:81:56 | myMaybePassword | provenance | |
152
| rncryptor.swift:69:24:69:24 | abc123 | rncryptor.swift:77:89:77:89 | myConstPassword | provenance | |
163
| rncryptor.swift:69:24:69:24 | abc123 | rncryptor.swift:78:56:78:56 | myConstPassword | provenance | |
174
| rncryptor.swift:69:24:69:24 | abc123 | rncryptor.swift:80:89:80:89 | myMaybePassword | provenance | |
@@ -43,15 +30,7 @@ edges
4330
| test.swift:44:31:44:48 | call to getConstantArray() [Collection element] | test.swift:63:40:63:40 | constantStringPassword | provenance | |
4431
| test.swift:44:31:44:48 | call to getConstantArray() [Collection element] | test.swift:68:34:68:34 | constantStringPassword | provenance | |
4532
nodes
46-
| rncryptor.swift:60:9:60:65 | call to String.init(_:) | semmle.label | call to String.init(_:) |
47-
| rncryptor.swift:60:9:60:65 | call to String.init(_:) [Collection element] | semmle.label | call to String.init(_:) [Collection element] |
48-
| rncryptor.swift:60:16:60:16 | ............ | semmle.label | ............ |
49-
| rncryptor.swift:60:16:60:64 | call to map(_:) | semmle.label | call to map(_:) |
50-
| rncryptor.swift:68:25:68:44 | call to getARandomPassword() | semmle.label | call to getARandomPassword() |
51-
| rncryptor.swift:68:25:68:44 | call to getARandomPassword() [Collection element] | semmle.label | call to getARandomPassword() [Collection element] |
5233
| rncryptor.swift:69:24:69:24 | abc123 | semmle.label | abc123 |
53-
| rncryptor.swift:74:89:74:89 | myRandomPassword | semmle.label | myRandomPassword |
54-
| rncryptor.swift:75:56:75:56 | myRandomPassword | semmle.label | myRandomPassword |
5534
| rncryptor.swift:77:89:77:89 | myConstPassword | semmle.label | myConstPassword |
5635
| rncryptor.swift:78:56:78:56 | myConstPassword | semmle.label | myConstPassword |
5736
| rncryptor.swift:80:89:80:89 | myMaybePassword | semmle.label | myMaybePassword |
@@ -86,13 +65,9 @@ nodes
8665
| test.swift:68:34:68:34 | constantStringPassword | semmle.label | constantStringPassword |
8766
subpaths
8867
#select
89-
| rncryptor.swift:74:89:74:89 | myRandomPassword | rncryptor.swift:60:16:60:16 | ............ | rncryptor.swift:74:89:74:89 | myRandomPassword | The value '............' is used as a constant password. |
90-
| rncryptor.swift:75:56:75:56 | myRandomPassword | rncryptor.swift:60:16:60:16 | ............ | rncryptor.swift:75:56:75:56 | myRandomPassword | The value '............' is used as a constant password. |
9168
| rncryptor.swift:77:89:77:89 | myConstPassword | rncryptor.swift:69:24:69:24 | abc123 | rncryptor.swift:77:89:77:89 | myConstPassword | The value 'abc123' is used as a constant password. |
9269
| rncryptor.swift:78:56:78:56 | myConstPassword | rncryptor.swift:69:24:69:24 | abc123 | rncryptor.swift:78:56:78:56 | myConstPassword | The value 'abc123' is used as a constant password. |
93-
| rncryptor.swift:80:89:80:89 | myMaybePassword | rncryptor.swift:60:16:60:16 | ............ | rncryptor.swift:80:89:80:89 | myMaybePassword | The value '............' is used as a constant password. |
9470
| rncryptor.swift:80:89:80:89 | myMaybePassword | rncryptor.swift:69:24:69:24 | abc123 | rncryptor.swift:80:89:80:89 | myMaybePassword | The value 'abc123' is used as a constant password. |
95-
| rncryptor.swift:81:56:81:56 | myMaybePassword | rncryptor.swift:60:16:60:16 | ............ | rncryptor.swift:81:56:81:56 | myMaybePassword | The value '............' is used as a constant password. |
9671
| rncryptor.swift:81:56:81:56 | myMaybePassword | rncryptor.swift:69:24:69:24 | abc123 | rncryptor.swift:81:56:81:56 | myMaybePassword | The value 'abc123' is used as a constant password. |
9772
| rncryptor.swift:91:39:91:39 | myConstPassword | rncryptor.swift:69:24:69:24 | abc123 | rncryptor.swift:91:39:91:39 | myConstPassword | The value 'abc123' is used as a constant password. |
9873
| rncryptor.swift:92:37:92:37 | myConstPassword | rncryptor.swift:69:24:69:24 | abc123 | rncryptor.swift:92:37:92:37 | myConstPassword | The value 'abc123' is used as a constant password. |

0 commit comments

Comments
 (0)