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

Unified Diff: content/browser/frame_host/render_frame_proxy_host.cc

Issue 2908433003: RenderFrameProxyHost::OnOpenURL needs to validate resource request body. (Closed)
Patch Set: Rebasing... Created 3 years, 7 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
Index: content/browser/frame_host/render_frame_proxy_host.cc
diff --git a/content/browser/frame_host/render_frame_proxy_host.cc b/content/browser/frame_host/render_frame_proxy_host.cc
index 1107e77fe4508b99b5a2f3446bf766bf59c7ad7d..725492de62a2806e96b3234b355c3a9c45fc98cc 100644
--- a/content/browser/frame_host/render_frame_proxy_host.cc
+++ b/content/browser/frame_host/render_frame_proxy_host.cc
@@ -8,6 +8,7 @@
#include "base/lazy_instance.h"
#include "content/browser/bad_message.h"
+#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/frame_host/cross_process_frame_connector.h"
#include "content/browser/frame_host/frame_tree.h"
#include "content/browser/frame_host/frame_tree_node.h"
@@ -32,7 +33,8 @@ typedef base::hash_map<RenderFrameProxyHostID, RenderFrameProxyHost*>
RoutingIDFrameProxyMap;
base::LazyInstance<RoutingIDFrameProxyMap>::DestructorAtExit
g_routing_id_frame_proxy_map = LAZY_INSTANCE_INITIALIZER;
-}
+
+} // namespace
// static
RenderFrameProxyHost* RenderFrameProxyHost::FromID(int process_id,
@@ -250,6 +252,15 @@ void RenderFrameProxyHost::OnOpenURL(
if (!site_instance_->IsRelatedSiteInstance(current_rfh->GetSiteInstance()))
return;
+ // Verify if the request originator (*not* |current_rfh|) has access to the
+ // contents of the POST body.
+ if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanReadRequestBody(
+ GetSiteInstance(), params.resource_request_body)) {
+ bad_message::ReceivedBadMessage(GetProcess(),
+ bad_message::RFPH_ILLEGAL_UPLOAD_PARAMS);
+ return;
+ }
+
// Since this navigation targeted a specific RenderFrameProxy, it should stay
// in the current tab.
DCHECK_EQ(WindowOpenDisposition::CURRENT_TAB, params.disposition);
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | content/browser/security_exploit_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698