Skip to content

Commit 9780dff

Browse files
authored
Merge pull request #10596 from geoffw0/swifturl
Swift: URL is a struct, not a class
2 parents 82bbe67 + 3ffb2a3 commit 9780dff

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

swift/ql/lib/codeql/swift/dataflow/internal/TaintTrackingPrivate.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ private module Cached {
4949
)
5050
or
5151
// allow flow through `URL.init`.
52-
exists(CallExpr call, ClassDecl c, AbstractFunctionDecl f |
52+
exists(CallExpr call, StructDecl c, AbstractFunctionDecl f |
5353
c.getName() = "URL" and
5454
c.getAMember() = f and
5555
f.getName() = ["init(string:)", "init(string:relativeTo:)"] and

swift/ql/src/queries/Security/CWE-311/CleartextTransmission.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Url extends Transmitted {
4646
Url() {
4747
// `string` arg in `URL.init` is a sink
4848
// (we assume here that the URL goes on to be used in a network operation)
49-
exists(ClassDecl c, AbstractFunctionDecl f, CallExpr call |
49+
exists(StructDecl c, AbstractFunctionDecl f, CallExpr call |
5050
c.getName() = "URL" and
5151
c.getAMember() = f and
5252
f.getName() = ["init(string:)", "init(string:relativeTo:)"] and

swift/ql/test/library-tests/dataflow/taint/url.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
class URL
2+
struct URL
33
{
44
init?(string: String) {}
55
init?(string: String, relativeTo: URL?) {}

swift/ql/test/query-tests/Security/CWE-079/UnsafeWebViewFetch.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class NSObject
55
{
66
}
77

8-
class URL
8+
struct URL
99
{
1010
init?(string: String) {}
1111
init?(string: String, relativeTo: URL?) {}
@@ -14,9 +14,9 @@ class URL
1414
extension String {
1515
init(contentsOf: URL) throws {
1616
var data = ""
17-
17+
1818
// ...
19-
19+
2020
self.init(data)
2121
}
2222
}

swift/ql/test/query-tests/Security/CWE-311/testURL.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
// --- stubs ---
33

4-
class URL
4+
struct URL
55
{
66
init?(string: String) {}
77
init?(string: String, relativeTo: URL?) {}

0 commit comments

Comments
 (0)