@@ -23,8 +23,8 @@ import codeql.swift.frameworks.StandardLibrary.String
23
23
* A taint source that is `String(contentsOf:)`.
24
24
* TODO: this shouldn't be needed when `StringSource` in `String.qll` is working.
25
25
*/
26
- class StringContentsOfURLSource extends RemoteFlowSource {
27
- StringContentsOfURLSource ( ) {
26
+ class StringContentsOfUrlSource extends RemoteFlowSource {
27
+ StringContentsOfUrlSource ( ) {
28
28
exists ( CallExpr call , AbstractFunctionDecl f |
29
29
call .getFunction ( ) .( ApplyExpr ) .getStaticTarget ( ) = f and
30
30
f .getName ( ) = "init(contentsOf:)" and
@@ -41,12 +41,12 @@ class StringContentsOfURLSource extends RemoteFlowSource {
41
41
* to `UIWebView.loadHTMLString`.
42
42
*/
43
43
class Sink extends DataFlow:: Node {
44
- Expr baseURL ;
44
+ Expr baseUrl ;
45
45
46
46
Sink ( ) {
47
47
exists (
48
48
AbstractFunctionDecl funcDecl , CallExpr call , string funcName , string paramName , int arg ,
49
- int baseURLarg
49
+ int baseUrlArg
50
50
|
51
51
// arguments to method calls...
52
52
exists ( string className , ClassDecl c |
@@ -75,19 +75,19 @@ class Sink extends DataFlow::Node {
75
75
funcDecl .getParam ( pragma [ only_bind_into ] ( arg ) ) .getName ( ) = paramName and
76
76
call .getArgument ( pragma [ only_bind_into ] ( arg ) ) .getExpr ( ) = this .asExpr ( ) and
77
77
// match up `baseURLArg`
78
- funcDecl .getParam ( pragma [ only_bind_into ] ( baseURLarg ) ) .getName ( ) = "baseURL" and
79
- call .getArgument ( pragma [ only_bind_into ] ( baseURLarg ) ) .getExpr ( ) = baseURL
78
+ funcDecl .getParam ( pragma [ only_bind_into ] ( baseUrlArg ) ) .getName ( ) = "baseURL" and
79
+ call .getArgument ( pragma [ only_bind_into ] ( baseUrlArg ) ) .getExpr ( ) = baseUrl
80
80
)
81
81
}
82
82
83
83
/**
84
84
* Gets the `baseURL` argument associated with this sink.
85
85
*/
86
- Expr getBaseURL ( ) { result = baseURL }
86
+ Expr getBaseUrl ( ) { result = baseUrl }
87
87
}
88
88
89
89
/**
90
- * Taint configuration from taint sources to sinks (and `baseURL` arguments)
90
+ * A taint configuration from taint sources to sinks (and `baseURL` arguments)
91
91
* for this query.
92
92
*/
93
93
class UnsafeWebViewFetchConfig extends TaintTracking:: Configuration {
@@ -133,11 +133,11 @@ where
133
133
sink = sinkNode .getNode ( ) and
134
134
(
135
135
// base URL is nil
136
- sink .getBaseURL ( ) instanceof NilLiteralExpr and
136
+ sink .getBaseUrl ( ) instanceof NilLiteralExpr and
137
137
message = "Tainted data is used in a WebView fetch without restricting the base URL."
138
138
or
139
139
// base URL is tainted
140
- config .hasFlow ( _, any ( DataFlow:: Node n | n .asExpr ( ) = sink .getBaseURL ( ) ) ) and
140
+ config .hasFlow ( _, any ( DataFlow:: Node n | n .asExpr ( ) = sink .getBaseUrl ( ) ) ) and
141
141
message = "Tainted data is used in a WebView fetch with a tainted base URL."
142
142
)
143
143
select sinkNode , sourceNode , sinkNode , message
0 commit comments