SHA256
fix(ios): restrict authentication capabilities and validate bootstrap types
Require iOS 18.4 for explicit upload denial in the isolated authentication window. Add origin-bound generated download policy, app-switcher privacy, typed metadata regressions and original community icon assets. Seven portable tests and Swift formatting checks pass; Apple SDK validation remains external.
This commit is contained in:
1 parent
74c2c9e6e8
commit
69c48169e2
15 files changed
+341
-112
No files matched your search
@@ -7,7 +7,7 @@ struct AuthenticationView: View {
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
IsolatedAuthentication(url: destination, model: model)
|
||||
.navigationTitle("Isolated web sign-in")
|
||||
.navigationTitle(model.authenticationHost)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar { Button("Close") { model.authentication = nil } }
|
||||
}
|
||||
@@ -33,15 +33,26 @@ struct IsolatedAuthentication: UIViewRepresentable {
|
||||
}
|
||||
func updateUIView(_ uiView: WKWebView, context: Context) {}
|
||||
static func dismantleUIView(_ uiView: WKWebView, coordinator: Coordinator) {
|
||||
uiView.stopLoading(); uiView.navigationDelegate = nil; uiView.uiDelegate = nil
|
||||
uiView.stopLoading()
|
||||
uiView.navigationDelegate = nil
|
||||
uiView.uiDelegate = nil
|
||||
}
|
||||
final class Coordinator: NSObject, WKNavigationDelegate, WKUIDelegate {
|
||||
let model: BrowserModel
|
||||
init(_ model: BrowserModel) { self.model = model }
|
||||
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction,
|
||||
decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
|
||||
func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
|
||||
model.authenticationHost = webView.url?.host ?? "Sign in"
|
||||
}
|
||||
func webView(
|
||||
_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction,
|
||||
decisionHandler: @escaping (WKNavigationActionPolicy) -> Void
|
||||
) {
|
||||
guard let url = navigationAction.request.url, url.scheme == "https",
|
||||
url.user == nil, url.password == nil else { decisionHandler(.cancel); return }
|
||||
url.user == nil, url.password == nil
|
||||
else {
|
||||
decisionHandler(.cancel)
|
||||
return
|
||||
}
|
||||
decisionHandler(.allow)
|
||||
}
|
||||
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
|
||||
@@ -50,8 +61,17 @@ struct IsolatedAuthentication: UIViewRepresentable {
|
||||
model.web.load(URLRequest(url: url))
|
||||
}
|
||||
}
|
||||
func webView(_ webView: WKWebView, requestMediaCapturePermissionFor origin: WKSecurityOrigin,
|
||||
initiatedByFrame frame: WKFrameInfo, type: WKMediaCaptureType,
|
||||
decisionHandler: @escaping (WKPermissionDecision) -> Void) { decisionHandler(.deny) }
|
||||
func webView(
|
||||
_ webView: WKWebView, requestMediaCapturePermissionFor origin: WKSecurityOrigin,
|
||||
initiatedByFrame frame: WKFrameInfo, type: WKMediaCaptureType,
|
||||
decisionHandler: @escaping (WKPermissionDecision) -> Void
|
||||
) { decisionHandler(.deny) }
|
||||
func webView(
|
||||
_ webView: WKWebView, runOpenPanelWith parameters: WKOpenPanelParameters,
|
||||
initiatedByFrame frame: WKFrameInfo,
|
||||
completionHandler: @escaping @MainActor @Sendable ([URL]?) -> Void
|
||||
) {
|
||||
completionHandler(nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user