Skip to content

Commit 5b31da4

Browse files
authored
Merge pull request github#11424 from geoffw0/alamofire3
Swift: Alamofire taint sources
2 parents 6b9cab2 + 64fb98e commit 5b31da4

File tree

4 files changed

+601
-0
lines changed

4 files changed

+601
-0
lines changed

swift/ql/lib/codeql/swift/dataflow/ExternalFlow.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ private module Frameworks {
8686
private import codeql.swift.frameworks.StandardLibrary.Url
8787
private import codeql.swift.frameworks.StandardLibrary.UrlSession
8888
private import codeql.swift.frameworks.StandardLibrary.WebView
89+
private import codeql.swift.frameworks.Alamofire.Alamofire
8990
}
9091

9192
/**
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Models for the Alamofire networking library.
3+
*/
4+
5+
import swift
6+
private import codeql.swift.dataflow.DataFlow
7+
private import codeql.swift.dataflow.ExternalFlow
8+
private import codeql.swift.dataflow.FlowSources
9+
10+
private class StringSource extends SourceModelCsv {
11+
override predicate row(string row) {
12+
row =
13+
[
14+
// `DataResponse.data`, `.value`, `.result`
15+
";DataResponse;true;data;;;;remote", ";DataResponse;true;value;;;;remote",
16+
";DataResponse;true;result;;;;remote",
17+
// `DownloadResponse.data`, `.value`, `.result`
18+
";DownloadResponse;true;data;;;;remote", ";DownloadResponse;true;value;;;;remote",
19+
";DownloadResponse;true;result;;;;remote",
20+
]
21+
}
22+
}

swift/ql/test/library-tests/dataflow/flowsources/FlowSources.expected

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,35 @@
1+
| alamofire.swift:91:27:91:27 | .result | external |
2+
| alamofire.swift:99:27:99:27 | .result | external |
3+
| alamofire.swift:344:23:344:32 | .data | external |
4+
| alamofire.swift:351:22:351:31 | .value | external |
5+
| alamofire.swift:358:23:358:32 | .value | external |
6+
| alamofire.swift:365:22:365:31 | .value | external |
7+
| alamofire.swift:372:23:372:32 | .value | external |
8+
| alamofire.swift:379:28:379:37 | .value | external |
9+
| alamofire.swift:389:28:389:28 | call to init(contentsOfFile:) | external |
10+
| alamofire.swift:389:28:389:55 | call to init(contentsOfFile:) | external |
11+
| alamofire.swift:396:22:396:31 | .value | external |
12+
| alamofire.swift:403:22:403:31 | .value | external |
13+
| alamofire.swift:404:28:404:28 | call to init(contentsOf:) | external |
14+
| alamofire.swift:404:28:404:50 | call to init(contentsOf:) | external |
15+
| alamofire.swift:411:23:411:32 | .value | external |
16+
| alamofire.swift:418:22:418:31 | .value | external |
17+
| alamofire.swift:425:23:425:32 | .value | external |
18+
| alamofire.swift:431:28:431:37 | .value | external |
19+
| alamofire.swift:448:20:448:20 | call to init(contentsOfFile:) | external |
20+
| alamofire.swift:448:20:448:49 | call to init(contentsOfFile:) | external |
21+
| alamofire.swift:455:23:455:32 | .data | external |
22+
| alamofire.swift:461:23:461:32 | .data | external |
123
| customurlschemes.swift:30:44:30:54 | url | external |
224
| customurlschemes.swift:34:52:34:68 | url | external |
325
| customurlschemes.swift:38:52:38:62 | url | external |
426
| customurlschemes.swift:43:9:43:28 | ...[...] | Remote URL in UIApplicationDelegate.application.launchOptions |
527
| customurlschemes.swift:48:9:48:28 | ...[...] | Remote URL in UIApplicationDelegate.application.launchOptions |
628
| data.swift:18:20:18:20 | call to init(contentsOf:options:) | external |
729
| data.swift:18:20:18:54 | call to init(contentsOf:options:) | external |
30+
| file://:0:0:0:0 | .data | external |
31+
| file://:0:0:0:0 | .result | external |
32+
| file://:0:0:0:0 | .result | external |
833
| file://:0:0:0:0 | .source1 | external |
934
| file://:0:0:0:0 | .source1 | external |
1035
| file://:0:0:0:0 | .source4 | external |

0 commit comments

Comments
 (0)