Skip to content

Commit

Permalink
Filter more incoming URLs in the CreateWindow path.
Browse files Browse the repository at this point in the history
BUG=170532

Review URL: https://chromiumcodereview.appspot.com/12036002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178728 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
cevans@chromium.org committed Jan 25, 2013
1 parent 3c8352c commit 7f48b71
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions content/browser/renderer_host/render_message_filter.cc
Expand Up @@ -462,8 +462,8 @@ void RenderMessageFilter::OnCreateWindow(
bool no_javascript_access;
bool can_create_window =
GetContentClient()->browser()->CanCreateWindow(
GURL(params.opener_url),
GURL(params.opener_security_origin),
params.opener_url,
params.opener_security_origin,
params.window_container_type,
resource_context_,
render_process_id_,
Expand Down
4 changes: 3 additions & 1 deletion content/browser/renderer_host/render_view_host_impl.cc
Expand Up @@ -1056,8 +1056,10 @@ void RenderViewHostImpl::CreateNewWindow(
ViewHostMsg_CreateWindow_Params validated_params(params);
ChildProcessSecurityPolicyImpl* policy =
ChildProcessSecurityPolicyImpl::GetInstance();
// TODO(cevans): also validate opener_url, opener_security_origin.
FilterURL(policy, GetProcess(), false, &validated_params.target_url);
FilterURL(policy, GetProcess(), false, &validated_params.opener_url);
FilterURL(policy, GetProcess(), true,
&validated_params.opener_security_origin);

delegate_->CreateNewWindow(route_id, validated_params,
session_storage_namespace);
Expand Down
2 changes: 1 addition & 1 deletion content/common/view_messages.h
Expand Up @@ -314,7 +314,7 @@ IPC_STRUCT_BEGIN(ViewHostMsg_CreateWindow_Params)
IPC_STRUCT_MEMBER(GURL, opener_url)

// The security origin of the frame initiating the open.
IPC_STRUCT_MEMBER(std::string, opener_security_origin)
IPC_STRUCT_MEMBER(GURL, opener_security_origin)

// Whether the opener will be suppressed in the new window, in which case
// scripting the new window is not allowed.
Expand Down
6 changes: 4 additions & 2 deletions content/renderer/render_view_impl.cc
Expand Up @@ -1849,8 +1849,10 @@ WebView* RenderViewImpl::createView(
params.frame_name = frame_name;
params.opener_frame_id = creator->identifier();
params.opener_url = creator->document().url();
params.opener_security_origin =
creator->document().securityOrigin().toString().utf8();
GURL security_url(creator->document().securityOrigin().toString().utf8());
if (!security_url.is_valid())
security_url = GURL();
params.opener_security_origin = security_url;
params.opener_suppressed = creator->willSuppressOpenerInNewFrame();
params.disposition = NavigationPolicyToDisposition(policy);
if (!request.isNull())
Expand Down

0 comments on commit 7f48b71

Please sign in to comment.