Skip to content

Commit e9a46c9

Browse files
committed
Add taint for URLRequest fields
1 parent cd59640 commit e9a46c9

File tree

4 files changed

+915
-569
lines changed

4 files changed

+915
-569
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@ private class UriFieldsInheritTaint extends TaintInheritingContent, DataFlow::Co
1515
UriFieldsInheritTaint() { this.getField().getEnclosingDecl() instanceof UrlDecl }
1616
}
1717

18+
/**
19+
* A content implying that, if a `URLRequest` is tainted, then its fields `url`, `httpBody`,
20+
* `httpBodyStream`, `mainDocument` and `allHTTPHeaderFields` are tainted.
21+
*/
22+
private class UrlRequestFieldsInheritTaint extends TaintInheritingContent,
23+
DataFlow::Content::FieldContent {
24+
UrlRequestFieldsInheritTaint() {
25+
this.getField().getEnclosingDecl().(NominalTypeDecl).getName() = "URLRequest" and
26+
this.getField().getName() =
27+
["url", "httpBody", "httpBodyStream", "mainDocument", "allHTTPHeaderFields"]
28+
}
29+
}
30+
1831
/**
1932
* A model for `URL` members that are sources of remote flow.
2033
*/

0 commit comments

Comments
 (0)