File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed
swift/ql/lib/codeql/swift/security Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,23 @@ private class AlamofireTransmittedSink extends CleartextTransmissionSink {
48
48
}
49
49
}
50
50
51
+ /**
52
+ * A `URL` that is a sink for this query. Not all URLs are considered sinks, depending
53
+ * on their content.
54
+ */
55
+ private class URLTransmittedSink extends CleartextTransmissionSink {
56
+ URLTransmittedSink ( ) {
57
+ // sinks are the first argument containing the URL, and the `parameters`
58
+ // and `headers` arguments to appropriate methods of `Session`.
59
+ exists ( CallExpr call |
60
+ call .getStaticTarget ( )
61
+ .( Method )
62
+ .hasQualifiedName ( "URL" , [ "init(string:)" , "init(string:relativeTo:)" ] ) and
63
+ call .getArgument ( 0 ) .getExpr ( ) = this .asExpr ( )
64
+ )
65
+ }
66
+ }
67
+
51
68
/**
52
69
* A barrier for cleartext transmission vulnerabilities.
53
70
* - encryption; encrypted values are not cleartext.
@@ -81,12 +98,6 @@ private class DefaultCleartextTransmissionSink extends CleartextTransmissionSink
81
98
private class TransmissionSinks extends SinkModelCsv {
82
99
override predicate row ( string row ) {
83
100
row =
84
- [
85
- ";NWConnection;true;send(content:contentContext:isComplete:completion:);;;Argument[0];transmission" ,
86
- // an `Expr` that is used to form a `URL` is very likely to be transmitted over a network, because
87
- // that's what URLs are for.
88
- ";URL;true;init(string:);;;Argument[0];transmission" ,
89
- ";URL;true;init(string:relativeTo:);;;Argument[0];transmission" ,
90
- ]
101
+ ";NWConnection;true;send(content:contentContext:isComplete:completion:);;;Argument[0];transmission"
91
102
}
92
103
}
You can’t perform that action at this time.
0 commit comments