diff --git a/content/browser/webui/web_ui_url_loader_factory.cc b/content/browser/webui/web_ui_url_loader_factory.cc index 8bd18013afd9f..ebc314dc3d8ee 100644 --- a/content/browser/webui/web_ui_url_loader_factory.cc +++ b/content/browser/webui/web_ui_url_loader_factory.cc @@ -288,6 +288,18 @@ class WebUIURLLoaderFactory : public network::SelfDeletingURLLoaderFactory { allowed_hosts_.find(request.url.GetHost()) != allowed_hosts_.end())) << "Incorrect host: " << request.url.GetHost(); + // SECURITY: the blob-internals / network-error / dino special cases below + // bypass URLDataManagerBackend host validation entirely. They must only be + // reachable for the chrome:// scheme; this factory is also instantiated for + // chrome-search:// (handed to the third-party remote-NTP renderer with an + // empty allowed_hosts set) and chrome-untrusted://, and those renderers + // must not be able to read profile-wide blob-internals. + if (scheme_ != kChromeUIScheme) { + CHECK_NE(request.url.host(), kChromeUIBlobInternalsHost); + CHECK_NE(request.url.host(), kChromeUINetworkErrorHost); + CHECK_NE(request.url.host(), kChromeUIDinoHost); + } + if (request.url.host() == kChromeUIBlobInternalsHost) { GetIOThreadTaskRunner({})->PostTask( FROM_HERE,