Skip to content

Commit 4e7c77f

Browse files
committed
unified: Update path injection test output
1 parent ee1f9a6 commit 4e7c77f

2 files changed

Lines changed: 30 additions & 4 deletions

File tree

‎unified/ql/test/query-tests/security/CWE-022/PathInjection/PathInjectionTest.expected‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,18 @@
7373
| testPathInjection.swift:447:40:447:51 | remoteString | testPathInjection.swift:340:24:340:78 | String(...) | testPathInjection.swift:447:40:447:51 | remoteString | This path depends on a $@. | testPathInjection.swift:340:24:340:78 | String(...) | user-provided value |
7474
| testPathInjection.swift:456:15:456:26 | remoteString | testPathInjection.swift:340:24:340:78 | String(...) | testPathInjection.swift:456:15:456:26 | remoteString | This path depends on a $@. | testPathInjection.swift:340:24:340:78 | String(...) | user-provided value |
7575
| testPathInjection.swift:482:22:482:33 | remoteString | testPathInjection.swift:340:24:340:78 | String(...) | testPathInjection.swift:482:22:482:33 | remoteString | This path depends on a $@. | testPathInjection.swift:340:24:340:78 | String(...) | user-provided value |
76+
| testPathInjection.swift:484:24:484:30 | buffer2 | testPathInjection.swift:477:22:477:87 | Data(...) | testPathInjection.swift:484:24:484:30 | buffer2 | This path depends on a $@. | testPathInjection.swift:477:22:477:87 | Data(...) | user-provided value |
7677
| testPathInjection.swift:486:25:486:36 | remoteString | testPathInjection.swift:340:24:340:78 | String(...) | testPathInjection.swift:486:25:486:36 | remoteString | This path depends on a $@. | testPathInjection.swift:340:24:340:78 | String(...) | user-provided value |
7778
| testPathInjection.swift:498:49:498:60 | remoteString | testPathInjection.swift:340:24:340:78 | String(...) | testPathInjection.swift:498:49:498:60 | remoteString | This path depends on a $@. | testPathInjection.swift:340:24:340:78 | String(...) | user-provided value |
7879
| testPathInjection.swift:502:26:502:36 | remoteData2 | testPathInjection.swift:501:23:501:75 | Data(...) | testPathInjection.swift:502:26:502:36 | remoteData2 | This path depends on a $@. | testPathInjection.swift:501:23:501:75 | Data(...) | user-provided value |
7980
| testPathInjection.swift:512:37:512:48 | remoteString | testPathInjection.swift:506:24:506:78 | String(...) | testPathInjection.swift:512:37:512:48 | remoteString | This path depends on a $@. | testPathInjection.swift:506:24:506:78 | String(...) | user-provided value |
8081
| testPathInjection.swift:514:33:514:44 | remoteString | testPathInjection.swift:506:24:506:78 | String(...) | testPathInjection.swift:514:33:514:44 | remoteString | This path depends on a $@. | testPathInjection.swift:506:24:506:78 | String(...) | user-provided value |
8182
| testPathInjection.swift:526:28:526:66 | ... .appendingPathComponent(...) | testPathInjection.swift:521:24:521:78 | String(...) | testPathInjection.swift:526:28:526:66 | ... .appendingPathComponent(...) | This path depends on a $@. | testPathInjection.swift:521:24:521:78 | String(...) | user-provided value |
8283
| testPathInjection.swift:527:28:527:93 | ... .appendingPathComponent(...) | testPathInjection.swift:521:24:521:78 | String(...) | testPathInjection.swift:527:28:527:93 | ... .appendingPathComponent(...) | This path depends on a $@. | testPathInjection.swift:521:24:521:78 | String(...) | user-provided value |
84+
| testPathInjection.swift:529:28:529:29 | u1 | testPathInjection.swift:521:24:521:78 | String(...) | testPathInjection.swift:529:28:529:29 | u1 | This path depends on a $@. | testPathInjection.swift:521:24:521:78 | String(...) | user-provided value |
8385
| testPathInjection.swift:531:28:531:39 | remoteString | testPathInjection.swift:521:24:521:78 | String(...) | testPathInjection.swift:531:28:531:39 | remoteString | This path depends on a $@. | testPathInjection.swift:521:24:521:78 | String(...) | user-provided value |
8486
| testPathInjection.swift:537:24:537:63 | ... ! | testPathInjection.swift:521:24:521:78 | String(...) | testPathInjection.swift:537:24:537:63 | ... ! | This path depends on a $@. | testPathInjection.swift:521:24:521:78 | String(...) | user-provided value |
87+
| testPathInjection.swift:541:24:541:53 | ... ! | testPathInjection.swift:521:24:521:78 | String(...) | testPathInjection.swift:541:24:541:53 | ... ! | This path depends on a $@. | testPathInjection.swift:521:24:521:78 | String(...) | user-provided value |
8588
| testPathInjection.swift:543:32:543:43 | remoteString | testPathInjection.swift:521:24:521:78 | String(...) | testPathInjection.swift:543:32:543:43 | remoteString | This path depends on a $@. | testPathInjection.swift:521:24:521:78 | String(...) | user-provided value |
8689
| testPathInjection.swift:544:38:544:49 | remoteString | testPathInjection.swift:521:24:521:78 | String(...) | testPathInjection.swift:544:38:544:49 | remoteString | This path depends on a $@. | testPathInjection.swift:521:24:521:78 | String(...) | user-provided value |
8790
| testPathInjection.swift:545:45:545:56 | remoteString | testPathInjection.swift:521:24:521:78 | String(...) | testPathInjection.swift:545:45:545:56 | remoteString | This path depends on a $@. | testPathInjection.swift:521:24:521:78 | String(...) | user-provided value |
@@ -178,15 +181,21 @@ edges
178181
| testPathInjection.swift:426:42:426:53 | remoteString | testPathInjection.swift:426:42:426:72 | TypeCastExpr | provenance | |
179182
| testPathInjection.swift:430:39:430:50 | remoteString | testPathInjection.swift:430:15:430:51 | FilePath(...) | provenance | |
180183
| testPathInjection.swift:433:39:433:50 | remoteString | testPathInjection.swift:433:15:433:51 | FilePath(...) | provenance | |
184+
| testPathInjection.swift:477:9:477:18 | remoteData | testPathInjection.swift:479:5:479:14 | remoteData | provenance | |
185+
| testPathInjection.swift:477:22:477:87 | Data(...) | testPathInjection.swift:477:9:477:18 | remoteData | provenance | |
186+
| testPathInjection.swift:479:5:479:14 | remoteData | testPathInjection.swift:479:30:479:36 | [post] buffer2 | provenance | |
187+
| testPathInjection.swift:479:30:479:36 | [post] buffer2 | testPathInjection.swift:484:24:484:30 | buffer2 | provenance | |
181188
| testPathInjection.swift:501:9:501:19 | remoteData2 | testPathInjection.swift:502:26:502:36 | remoteData2 | provenance | |
182189
| testPathInjection.swift:501:23:501:75 | Data(...) | testPathInjection.swift:501:9:501:19 | remoteData2 | provenance | |
183190
| testPathInjection.swift:506:9:506:20 | remoteString | testPathInjection.swift:512:37:512:48 | remoteString | provenance | |
184191
| testPathInjection.swift:506:9:506:20 | remoteString | testPathInjection.swift:514:33:514:44 | remoteString | provenance | |
185192
| testPathInjection.swift:506:24:506:78 | String(...) | testPathInjection.swift:506:9:506:20 | remoteString | provenance | |
186193
| testPathInjection.swift:521:9:521:20 | remoteString | testPathInjection.swift:526:54:526:65 | remoteString | provenance | |
187194
| testPathInjection.swift:521:9:521:20 | remoteString | testPathInjection.swift:527:54:527:65 | remoteString | provenance | |
195+
| testPathInjection.swift:521:9:521:20 | remoteString | testPathInjection.swift:528:28:528:39 | remoteString | provenance | |
188196
| testPathInjection.swift:521:9:521:20 | remoteString | testPathInjection.swift:531:28:531:39 | remoteString | provenance | |
189197
| testPathInjection.swift:521:9:521:20 | remoteString | testPathInjection.swift:537:50:537:61 | remoteString | provenance | |
198+
| testPathInjection.swift:521:9:521:20 | remoteString | testPathInjection.swift:539:28:539:39 | remoteString | provenance | |
190199
| testPathInjection.swift:521:9:521:20 | remoteString | testPathInjection.swift:543:32:543:43 | remoteString | provenance | |
191200
| testPathInjection.swift:521:9:521:20 | remoteString | testPathInjection.swift:544:38:544:49 | remoteString | provenance | |
192201
| testPathInjection.swift:521:9:521:20 | remoteString | testPathInjection.swift:545:45:545:56 | remoteString | provenance | |
@@ -198,8 +207,13 @@ edges
198207
| testPathInjection.swift:527:28:527:66 | ... .appendingPathComponent(...) | testPathInjection.swift:16:74:16:77 | self | provenance | |
199208
| testPathInjection.swift:527:28:527:66 | ... .appendingPathComponent(...) | testPathInjection.swift:527:28:527:93 | ... .appendingPathComponent(...) | provenance | |
200209
| testPathInjection.swift:527:54:527:65 | remoteString | testPathInjection.swift:527:28:527:66 | ... .appendingPathComponent(...) | provenance | |
210+
| testPathInjection.swift:528:28:528:39 | remoteString | testPathInjection.swift:529:28:529:29 | u1 | provenance | |
201211
| testPathInjection.swift:537:24:537:62 | ... .appendingPathComponent(...) | testPathInjection.swift:537:24:537:63 | ... ! | provenance | |
202212
| testPathInjection.swift:537:50:537:61 | remoteString | testPathInjection.swift:537:24:537:62 | ... .appendingPathComponent(...) | provenance | |
213+
| testPathInjection.swift:539:9:539:10 | u4 | testPathInjection.swift:541:24:541:25 | u4 | provenance | |
214+
| testPathInjection.swift:539:28:539:39 | remoteString | testPathInjection.swift:539:9:539:10 | u4 | provenance | |
215+
| testPathInjection.swift:541:24:541:25 | u4 | testPathInjection.swift:541:24:541:52 | ... .appendingPathComponent(...) | provenance | |
216+
| testPathInjection.swift:541:24:541:52 | ... .appendingPathComponent(...) | testPathInjection.swift:541:24:541:53 | ... ! | provenance | |
203217
| testPathInjection.swift:548:5:548:6 | [post] s1 [pointee] | testPathInjection.swift:549:32:549:33 | s1 [pointee] | provenance | |
204218
| testPathInjection.swift:548:5:548:14 | ... .pointee | testPathInjection.swift:548:5:548:6 | [post] s1 [pointee] | provenance | |
205219
| testPathInjection.swift:548:18:548:29 | remoteString | testPathInjection.swift:548:5:548:14 | ... .pointee | provenance | |
@@ -294,7 +308,12 @@ nodes
294308
| testPathInjection.swift:445:33:445:44 | remoteString | semmle.label | remoteString |
295309
| testPathInjection.swift:447:40:447:51 | remoteString | semmle.label | remoteString |
296310
| testPathInjection.swift:456:15:456:26 | remoteString | semmle.label | remoteString |
311+
| testPathInjection.swift:477:9:477:18 | remoteData | semmle.label | remoteData |
312+
| testPathInjection.swift:477:22:477:87 | Data(...) | semmle.label | Data(...) |
313+
| testPathInjection.swift:479:5:479:14 | remoteData | semmle.label | remoteData |
314+
| testPathInjection.swift:479:30:479:36 | [post] buffer2 | semmle.label | [post] buffer2 |
297315
| testPathInjection.swift:482:22:482:33 | remoteString | semmle.label | remoteString |
316+
| testPathInjection.swift:484:24:484:30 | buffer2 | semmle.label | buffer2 |
298317
| testPathInjection.swift:486:25:486:36 | remoteString | semmle.label | remoteString |
299318
| testPathInjection.swift:498:49:498:60 | remoteString | semmle.label | remoteString |
300319
| testPathInjection.swift:501:9:501:19 | remoteData2 | semmle.label | remoteData2 |
@@ -311,10 +330,17 @@ nodes
311330
| testPathInjection.swift:527:28:527:66 | ... .appendingPathComponent(...) | semmle.label | ... .appendingPathComponent(...) |
312331
| testPathInjection.swift:527:28:527:93 | ... .appendingPathComponent(...) | semmle.label | ... .appendingPathComponent(...) |
313332
| testPathInjection.swift:527:54:527:65 | remoteString | semmle.label | remoteString |
333+
| testPathInjection.swift:528:28:528:39 | remoteString | semmle.label | remoteString |
334+
| testPathInjection.swift:529:28:529:29 | u1 | semmle.label | u1 |
314335
| testPathInjection.swift:531:28:531:39 | remoteString | semmle.label | remoteString |
315336
| testPathInjection.swift:537:24:537:62 | ... .appendingPathComponent(...) | semmle.label | ... .appendingPathComponent(...) |
316337
| testPathInjection.swift:537:24:537:63 | ... ! | semmle.label | ... ! |
317338
| testPathInjection.swift:537:50:537:61 | remoteString | semmle.label | remoteString |
339+
| testPathInjection.swift:539:9:539:10 | u4 | semmle.label | u4 |
340+
| testPathInjection.swift:539:28:539:39 | remoteString | semmle.label | remoteString |
341+
| testPathInjection.swift:541:24:541:25 | u4 | semmle.label | u4 |
342+
| testPathInjection.swift:541:24:541:52 | ... .appendingPathComponent(...) | semmle.label | ... .appendingPathComponent(...) |
343+
| testPathInjection.swift:541:24:541:53 | ... ! | semmle.label | ... ! |
318344
| testPathInjection.swift:543:32:543:43 | remoteString | semmle.label | remoteString |
319345
| testPathInjection.swift:544:38:544:49 | remoteString | semmle.label | remoteString |
320346
| testPathInjection.swift:545:45:545:56 | remoteString | semmle.label | remoteString |

‎unified/ql/test/query-tests/security/CWE-022/PathInjection/testPathInjection.swift‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,14 +474,14 @@ func test(buffer1: UnsafeMutablePointer<UInt8>, buffer2: UnsafeMutablePointer<UI
474474

475475
var db: OpaquePointer?
476476
let localData = Data(0)
477-
let remoteData = Data(contentsOf: URL(string: "http://example.com/")!, options: []) // $ MISSING: Source
477+
let remoteData = Data(contentsOf: URL(string: "http://example.com/")!, options: []) // $ Source
478478
localData.copyBytes(to: buffer1, count: localData.count)
479479
remoteData.copyBytes(to: buffer2, count: remoteData.count)
480480

481481
_ = sqlite3_open("myFile.sqlite3", &db) // GOOD
482482
_ = sqlite3_open(remoteString, &db) // $ Alert
483483
_ = sqlite3_open16(buffer1, &db) // GOOD
484-
_ = sqlite3_open16(buffer2, &db) // $ MISSING: Alert
484+
_ = sqlite3_open16(buffer2, &db) // $ Alert
485485
_ = sqlite3_open_v2("myFile.sqlite3", &db, 0, nil) // GOOD
486486
_ = sqlite3_open_v2(remoteString, &db, 0, nil) // $ Alert
487487

@@ -526,7 +526,7 @@ func testPathInjection2(
526526
_ = NSData(contentsOf: u1.appendingPathComponent(remoteString)) // $ Alert
527527
_ = NSData(contentsOf: u1.appendingPathComponent(remoteString).appendingPathComponent("")) // $ Alert
528528
u1.appendPathComponent(remoteString)
529-
_ = NSData(contentsOf: u1) // $ MISSING: Alert
529+
_ = NSData(contentsOf: u1) // $ Alert
530530

531531
let u2 = URL(filePath: remoteString) // $ Alert
532532
_ = NSData(contentsOf: u2) // $ MISSING: Alert
@@ -538,7 +538,7 @@ func testPathInjection2(
538538

539539
let u4 = NSURL(string: remoteString)!
540540
Data("").write(to: u4.filePathURL!, options: []) // $ MISSING: Alert
541-
Data("").write(to: u4.appendingPathComponent("")!, options: []) // $ MISSING: Alert
541+
Data("").write(to: u4.appendingPathComponent("")!, options: []) // $ Alert
542542

543543
_ = NSData(contentsOfFile: remoteString)! // $ Alert
544544
_ = NSData(contentsOfMappedFile: remoteString)! // $ Alert

0 commit comments

Comments
 (0)