From 68e2ea9db0b5a718b0f285a9bfd29819d9723d92 Mon Sep 17 00:00:00 2001 From: Matt Reagan Date: Thu, 16 Jan 2025 16:11:30 -0800 Subject: [PATCH] [FXIOS-10937] Bugzilla 1933079 --- .../BrowserViewController/Views/BrowserViewController.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/firefox-ios/Client/Frontend/Browser/BrowserViewController/Views/BrowserViewController.swift b/firefox-ios/Client/Frontend/Browser/BrowserViewController/Views/BrowserViewController.swift index 39c295f9ed81b..e41dfcb5e074c 100644 --- a/firefox-ios/Client/Frontend/Browser/BrowserViewController/Views/BrowserViewController.swift +++ b/firefox-ios/Client/Frontend/Browser/BrowserViewController/Views/BrowserViewController.swift @@ -1935,6 +1935,12 @@ class BrowserViewController: UIViewController, // Ensure we do have a URL from that observer guard let url = webView.url else { return } + // Security safety check (Bugzilla #1933079) + if let internalURL = InternalURL(url), internalURL.isErrorPage, !internalURL.isAuthorized { + tabManager.selectedTab?.webView?.load(URLRequest(url: URL(string: "about:blank")!)) + return + } + // To prevent spoofing, only change the URL immediately if the new URL is on // the same origin as the current URL. Otherwise, do nothing and wait for // didCommitNavigation to confirm the page load.