Chromium Code Reviews| Index: chrome/browser/net/chrome_extensions_network_delegate.cc |
| diff --git a/chrome/browser/net/chrome_extensions_network_delegate.cc b/chrome/browser/net/chrome_extensions_network_delegate.cc |
| index 5c7e33fad911c45680260f656c09cc40b205be15..7860b65f30f6f7bcf1ec6d6ae88c4916870c0234 100644 |
| --- a/chrome/browser/net/chrome_extensions_network_delegate.cc |
| +++ b/chrome/browser/net/chrome_extensions_network_delegate.cc |
| @@ -10,12 +10,14 @@ |
| #include "net/base/net_errors.h" |
| #if defined(ENABLE_EXTENSIONS) |
| +#include "base/debug/dump_without_crashing.h" |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/extensions/api/proxy/proxy_api.h" |
| #include "chrome/browser/extensions/event_router_forwarder.h" |
| #include "chrome/browser/profiles/profile_manager.h" |
| #include "chrome/browser/renderer_host/chrome_navigation_ui_data.h" |
| #include "content/public/browser/browser_thread.h" |
| +#include "content/public/browser/child_process_security_policy.h" |
| #include "content/public/browser/render_frame_host.h" |
| #include "content/public/browser/resource_request_info.h" |
| #include "content/public/common/browser_side_navigation_policy.h" |
| @@ -209,8 +211,20 @@ int ChromeExtensionsNetworkDelegateImpl::OnBeforeURLRequest( |
| extension && |
| extension->permissions_data()->HasAPIPermission( |
| extensions::APIPermission::kWebView); |
| - if (!has_webview_permission) |
| + // Check whether the request is coming from a <webview> guest process via |
| + // ChildProcessSecurityPolicy. A guest process should have already been |
| + // granted permission to request |origin| when its WebContents was created. |
| + // See https://crbug.com/656752. |
| + auto* policy = content::ChildProcessSecurityPolicy::GetInstance(); |
| + bool from_guest = |
| + policy->HasSpecificPermissionForOrigin(info->GetChildID(), origin); |
|
ncarter (slow)
2016/10/20 17:46:50
Does correctness here depend on my fix for the too
alexmos
2016/10/20 18:40:23
I think this is independent. The affected test fo
|
| + if (!has_webview_permission || !from_guest) { |
| + // TODO(alexmos): Temporary instrumentation to find any regressions for |
| + // this blocking. Remove after verifying that this is not breaking any |
| + // legitimate use cases. |
|
ncarter (slow)
2016/10/20 17:46:50
I recommend:
base::debug::Alias(&origin);
base::d
alexmos
2016/10/20 18:40:23
Done. Good idea.
|
| + base::debug::DumpWithoutCrashing(); |
|
ncarter (slow)
2016/10/20 17:46:50
There is some risk of ddos from really prolific DW
alexmos
2016/10/20 18:40:23
That sounds good. We'll definitely want enough ba
ncarter (slow)
2016/10/20 19:05:56
Good, we are on the same page. The DWOC should be
|
| return net::ERR_ABORTED; |
| + } |
| } |
| return ExtensionWebRequestEventRouter::GetInstance()->OnBeforeRequest( |