Skip to content

Commit 1221cba

Browse files
committed
Swift: Updated results after merge with main.
1 parent 1301815 commit 1221cba

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

swift/ql/test/query-tests/Security/CWE-089/SqlInjection.expected

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ edges
1414
| SQLite.swift:62:26:62:80 | call to init(contentsOf:) : | SQLite.swift:117:12:117:12 | unsafeQuery1 |
1515
| SQLite.swift:62:26:62:80 | call to init(contentsOf:) : | SQLite.swift:119:12:119:12 | unsafeQuery1 |
1616
| SQLite.swift:62:26:62:80 | call to init(contentsOf:) : | SQLite.swift:132:16:132:16 | remoteString |
17+
| sqlite3_c_api.swift:122:26:122:80 | call to init(contentsOf:) : | sqlite3_c_api.swift:133:33:133:33 | unsafeQuery1 |
18+
| sqlite3_c_api.swift:122:26:122:80 | call to init(contentsOf:) : | sqlite3_c_api.swift:134:33:134:33 | unsafeQuery2 |
19+
| sqlite3_c_api.swift:122:26:122:80 | call to init(contentsOf:) : | sqlite3_c_api.swift:135:33:135:33 | unsafeQuery3 |
20+
| sqlite3_c_api.swift:122:26:122:80 | call to init(contentsOf:) : | sqlite3_c_api.swift:145:26:145:26 | unsafeQuery3 |
21+
| sqlite3_c_api.swift:122:26:122:80 | call to init(contentsOf:) : | sqlite3_c_api.swift:175:29:175:29 | unsafeQuery3 |
1722
nodes
1823
| SQLite.swift:62:26:62:80 | call to init(contentsOf:) : | semmle.label | call to init(contentsOf:) : |
1924
| SQLite.swift:73:17:73:17 | unsafeQuery1 | semmle.label | unsafeQuery1 |
@@ -31,6 +36,12 @@ nodes
3136
| SQLite.swift:117:12:117:12 | unsafeQuery1 | semmle.label | unsafeQuery1 |
3237
| SQLite.swift:119:12:119:12 | unsafeQuery1 | semmle.label | unsafeQuery1 |
3338
| SQLite.swift:132:16:132:16 | remoteString | semmle.label | remoteString |
39+
| sqlite3_c_api.swift:122:26:122:80 | call to init(contentsOf:) : | semmle.label | call to init(contentsOf:) : |
40+
| sqlite3_c_api.swift:133:33:133:33 | unsafeQuery1 | semmle.label | unsafeQuery1 |
41+
| sqlite3_c_api.swift:134:33:134:33 | unsafeQuery2 | semmle.label | unsafeQuery2 |
42+
| sqlite3_c_api.swift:135:33:135:33 | unsafeQuery3 | semmle.label | unsafeQuery3 |
43+
| sqlite3_c_api.swift:145:26:145:26 | unsafeQuery3 | semmle.label | unsafeQuery3 |
44+
| sqlite3_c_api.swift:175:29:175:29 | unsafeQuery3 | semmle.label | unsafeQuery3 |
3445
subpaths
3546
#select
3647
| SQLite.swift:73:17:73:17 | unsafeQuery1 | SQLite.swift:62:26:62:80 | call to init(contentsOf:) : | SQLite.swift:73:17:73:17 | unsafeQuery1 | This query depends on a $@. | SQLite.swift:62:26:62:80 | call to init(contentsOf:) | user-provided value |
@@ -48,3 +59,8 @@ subpaths
4859
| SQLite.swift:117:12:117:12 | unsafeQuery1 | SQLite.swift:62:26:62:80 | call to init(contentsOf:) : | SQLite.swift:117:12:117:12 | unsafeQuery1 | This query depends on a $@. | SQLite.swift:62:26:62:80 | call to init(contentsOf:) | user-provided value |
4960
| SQLite.swift:119:12:119:12 | unsafeQuery1 | SQLite.swift:62:26:62:80 | call to init(contentsOf:) : | SQLite.swift:119:12:119:12 | unsafeQuery1 | This query depends on a $@. | SQLite.swift:62:26:62:80 | call to init(contentsOf:) | user-provided value |
5061
| SQLite.swift:132:16:132:16 | remoteString | SQLite.swift:62:26:62:80 | call to init(contentsOf:) : | SQLite.swift:132:16:132:16 | remoteString | This query depends on a $@. | SQLite.swift:62:26:62:80 | call to init(contentsOf:) | user-provided value |
62+
| sqlite3_c_api.swift:133:33:133:33 | unsafeQuery1 | sqlite3_c_api.swift:122:26:122:80 | call to init(contentsOf:) : | sqlite3_c_api.swift:133:33:133:33 | unsafeQuery1 | This query depends on a $@. | sqlite3_c_api.swift:122:26:122:80 | call to init(contentsOf:) | user-provided value |
63+
| sqlite3_c_api.swift:134:33:134:33 | unsafeQuery2 | sqlite3_c_api.swift:122:26:122:80 | call to init(contentsOf:) : | sqlite3_c_api.swift:134:33:134:33 | unsafeQuery2 | This query depends on a $@. | sqlite3_c_api.swift:122:26:122:80 | call to init(contentsOf:) | user-provided value |
64+
| sqlite3_c_api.swift:135:33:135:33 | unsafeQuery3 | sqlite3_c_api.swift:122:26:122:80 | call to init(contentsOf:) : | sqlite3_c_api.swift:135:33:135:33 | unsafeQuery3 | This query depends on a $@. | sqlite3_c_api.swift:122:26:122:80 | call to init(contentsOf:) | user-provided value |
65+
| sqlite3_c_api.swift:145:26:145:26 | unsafeQuery3 | sqlite3_c_api.swift:122:26:122:80 | call to init(contentsOf:) : | sqlite3_c_api.swift:145:26:145:26 | unsafeQuery3 | This query depends on a $@. | sqlite3_c_api.swift:122:26:122:80 | call to init(contentsOf:) | user-provided value |
66+
| sqlite3_c_api.swift:175:29:175:29 | unsafeQuery3 | sqlite3_c_api.swift:122:26:122:80 | call to init(contentsOf:) : | sqlite3_c_api.swift:175:29:175:29 | unsafeQuery3 | This query depends on a $@. | sqlite3_c_api.swift:122:26:122:80 | call to init(contentsOf:) | user-provided value |

swift/ql/test/query-tests/Security/CWE-089/sqlite3_c_api.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ func test_sqlite3_c_api(db: OpaquePointer?, buffer: UnsafeMutablePointer<UInt8>)
130130

131131
// --- exec ---
132132

133-
let result1 = sqlite3_exec(db, unsafeQuery1, nil, nil, nil) // BAD [NOT DETECTED]
134-
let result2 = sqlite3_exec(db, unsafeQuery2, nil, nil, nil) // BAD [NOT DETECTED]
135-
let result3 = sqlite3_exec(db, unsafeQuery3, nil, nil, nil) // BAD [NOT DETECTED]
133+
let result1 = sqlite3_exec(db, unsafeQuery1, nil, nil, nil) // BAD
134+
let result2 = sqlite3_exec(db, unsafeQuery2, nil, nil, nil) // BAD
135+
let result3 = sqlite3_exec(db, unsafeQuery3, nil, nil, nil) // BAD
136136
let result4 = sqlite3_exec(db, safeQuery1, nil, nil, nil) // GOOD
137137
let result5 = sqlite3_exec(db, safeQuery2, nil, nil, nil) // GOOD
138138

@@ -142,7 +142,7 @@ func test_sqlite3_c_api(db: OpaquePointer?, buffer: UnsafeMutablePointer<UInt8>)
142142

143143
var stmt1: OpaquePointer?
144144

145-
if (sqlite3_prepare(db, unsafeQuery3, -1, &stmt1, nil) == SQLITE_OK) { // BAD [NOT DETECTED]
145+
if (sqlite3_prepare(db, unsafeQuery3, -1, &stmt1, nil) == SQLITE_OK) { // BAD
146146
let result = sqlite3_step(stmt1)
147147
// ...
148148
}
@@ -172,7 +172,7 @@ func test_sqlite3_c_api(db: OpaquePointer?, buffer: UnsafeMutablePointer<UInt8>)
172172

173173
var stmt4: OpaquePointer?
174174

175-
if (sqlite3_prepare_v2(db, unsafeQuery3, -1, &stmt4, nil) == SQLITE_OK) { // BAD [NOT DETECTED]
175+
if (sqlite3_prepare_v2(db, unsafeQuery3, -1, &stmt4, nil) == SQLITE_OK) { // BAD
176176
let result = sqlite3_step(stmt4)
177177
// ...
178178
}

0 commit comments

Comments
 (0)