Skip to content

Commit 4e214e1

Browse files
authored
Merge pull request #14691 from geoffw0/webview2
Swift: Add a webview test case
2 parents c6193eb + 838a00b commit 4e214e1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

swift/ql/test/library-tests/dataflow/flowsources/webview.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ protocol Exported : JSExport {
5252
var tainted: Any { get }
5353
func tainted(arg1: Any, arg2: Any)
5454
}
55+
5556
class ExportedImpl : Exported {
5657
var tainted: Any { get { return "" } }
5758

@@ -80,3 +81,22 @@ extension Extended : WKNavigationDelegate {
8081
func webView(_: WKWebView, decidePolicyFor: WKNavigationAction, preferences: WKWebpagePreferences, decisionHandler: (WKNavigationActionPolicy, WKWebpagePreferences) -> Void) {} // $ source=remote
8182
func webView(_: WKWebView, decidePolicyFor: WKNavigationAction, decisionHandler: (WKNavigationActionPolicy) -> Void) {} // $ source=remote
8283
}
84+
85+
// ---
86+
87+
typealias JSExportAlias = JSExport
88+
89+
protocol Exported2 : JSExportAlias {
90+
var tainted: Any { get }
91+
}
92+
typealias Exported2Alias = Exported2
93+
94+
class ExportedImpl2 : Exported2Alias {
95+
var tainted: Any { get { return "" } }
96+
var notTainted: Any { get { return ""} }
97+
98+
func readFields() {
99+
tainted // $ source=remote
100+
notTainted
101+
}
102+
}

0 commit comments

Comments
 (0)