Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(518)

Unified Diff: ios/web/web_state/ui/crw_wk_web_view_web_controller.mm

Issue 1921553006: [ios] Do not allow loading chrome:// URLs from regular http/https pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/ui/crw_wk_web_view_web_controller.mm
diff --git a/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm b/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm
index 2c9dc72656fd4c8690494ff6eb8c6c6044fe6b25..b0c577530d4ecb132e57ba0b3923f8a274d1e921 100644
--- a/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm
+++ b/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm
@@ -1805,9 +1805,15 @@ WKWebViewErrorSource WKWebViewErrorSourceFromError(NSError* error) {
// TODO(crbug.com/546347): Extract necessary tasks for app specific URL
// navigation rather than restarting the load.
if (web::GetWebClient()->IsAppSpecificURL(webViewURL)) {
- [self abortWebLoad];
- web::WebLoadParams params(webViewURL);
- [self loadWithParams:params];
+ // Renderer-initiated loads of WebUI can be done only from other WebUI
+ // pages. WebUI pages may have increased power and using the same web
+ // process (which may potentially be controller by an attacker) is
+ // dangerous.
+ if (web::GetWebClient()->IsAppSpecificURL(_documentURL)) {
+ [self abortWebLoad];
+ web::WebLoadParams params(webViewURL);
+ [self loadWithParams:params];
+ }
return;
} else {
[self registerLoadRequest:webViewURL];
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698