Skip to content

Commit bc9d8cc

Browse files
committed
Swift: Get another SQLite.swift result.
1 parent 691665f commit bc9d8cc

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

swift/ql/lib/codeql/swift/frameworks/SQL/SQL.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ private class FilePathSummaries extends SummaryModelCsv {
1818
";Expression;true;init(_:_:);;;Argument[1].CollectionElement;ReturnValue;taint",
1919
";ExpressionType;true;init(_:);;;Argument[0];ReturnValue;taint",
2020
";ExpressionType;true;replace(_:with:);;;Argument[1];ReturnValue;taint",
21+
";Blob;true;init(bytes:);;;Argument[0];ReturnValue;taint",
22+
";Blob;true;init(bytes:length:);;;Argument[0];ReturnValue;taint",
2123
]
2224
}
2325
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ abstract class KeySource extends Expr { }
1717
* A literal byte array is a key source.
1818
*/
1919
class ByteArrayLiteralSource extends KeySource {
20-
ByteArrayLiteralSource() { this = any(ArrayExpr arr | arr.getType().getName() = "Array<UInt8>") }
20+
ByteArrayLiteralSource() { this = any(ArrayExpr arr | arr.getType().getName() = ["Array<UInt8>", "[UInt8]"]) }
2121
}
2222

2323
/**

swift/ql/test/query-tests/Security/CWE-321/HardcodedEncryptionKey.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
edges
2+
| SQLite.swift:54:25:54:33 | [...] | SQLite.swift:54:13:54:34 | call to Blob.init(bytes:) |
23
| cryptoswift.swift:76:3:76:3 | this string is constant | cryptoswift.swift:92:18:92:36 | call to getConstantString() |
34
| cryptoswift.swift:90:26:90:121 | [...] | cryptoswift.swift:117:22:117:22 | key |
45
| cryptoswift.swift:90:26:90:121 | [...] | cryptoswift.swift:118:22:118:22 | key |
@@ -56,6 +57,8 @@ nodes
5657
| SQLite.swift:45:23:45:23 | hardcoded_key | semmle.label | hardcoded_key |
5758
| SQLite.swift:47:15:47:15 | hardcoded_key | semmle.label | hardcoded_key |
5859
| SQLite.swift:49:79:49:79 | hardcoded_key | semmle.label | hardcoded_key |
60+
| SQLite.swift:54:13:54:34 | call to Blob.init(bytes:) | semmle.label | call to Blob.init(bytes:) |
61+
| SQLite.swift:54:25:54:33 | [...] | semmle.label | [...] |
5962
| cryptoswift.swift:76:3:76:3 | this string is constant | semmle.label | this string is constant |
6063
| cryptoswift.swift:90:26:90:121 | [...] | semmle.label | [...] |
6164
| cryptoswift.swift:92:18:92:36 | call to getConstantString() | semmle.label | call to getConstantString() |
@@ -119,6 +122,7 @@ subpaths
119122
| SQLite.swift:45:23:45:23 | hardcoded_key | SQLite.swift:45:23:45:23 | hardcoded_key | SQLite.swift:45:23:45:23 | hardcoded_key | The key 'hardcoded_key' has been initialized with hard-coded values from $@. | SQLite.swift:45:23:45:23 | hardcoded_key | hardcoded_key |
120123
| SQLite.swift:47:15:47:15 | hardcoded_key | SQLite.swift:47:15:47:15 | hardcoded_key | SQLite.swift:47:15:47:15 | hardcoded_key | The key 'hardcoded_key' has been initialized with hard-coded values from $@. | SQLite.swift:47:15:47:15 | hardcoded_key | hardcoded_key |
121124
| SQLite.swift:49:79:49:79 | hardcoded_key | SQLite.swift:49:79:49:79 | hardcoded_key | SQLite.swift:49:79:49:79 | hardcoded_key | The key 'hardcoded_key' has been initialized with hard-coded values from $@. | SQLite.swift:49:79:49:79 | hardcoded_key | hardcoded_key |
125+
| SQLite.swift:54:13:54:34 | call to Blob.init(bytes:) | SQLite.swift:54:25:54:33 | [...] | SQLite.swift:54:13:54:34 | call to Blob.init(bytes:) | The key 'call to Blob.init(bytes:)' has been initialized with hard-coded values from $@. | SQLite.swift:54:25:54:33 | [...] | [...] |
122126
| cryptoswift.swift:108:21:108:21 | keyString | cryptoswift.swift:76:3:76:3 | this string is constant | cryptoswift.swift:108:21:108:21 | keyString | The key 'keyString' has been initialized with hard-coded values from $@. | cryptoswift.swift:76:3:76:3 | this string is constant | this string is constant |
123127
| cryptoswift.swift:109:21:109:21 | keyString | cryptoswift.swift:76:3:76:3 | this string is constant | cryptoswift.swift:109:21:109:21 | keyString | The key 'keyString' has been initialized with hard-coded values from $@. | cryptoswift.swift:76:3:76:3 | this string is constant | this string is constant |
124128
| cryptoswift.swift:117:22:117:22 | key | cryptoswift.swift:90:26:90:121 | [...] | cryptoswift.swift:117:22:117:22 | key | The key 'key' has been initialized with hard-coded values from $@. | cryptoswift.swift:90:26:90:121 | [...] | [...] |

0 commit comments

Comments
 (0)