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

Unified Diff: content/browser/web_contents/render_view_host_manager.cc

Issue 11193051: To fix the cross-site post submission bug. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix FileRead Permission Created 8 years, 2 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/web_contents/render_view_host_manager.cc
diff --git a/content/browser/web_contents/render_view_host_manager.cc b/content/browser/web_contents/render_view_host_manager.cc
index 04150496949db6b6fbef21b22c733413a924a91f..6a7e6a4c0adee6ca678f0c1711ebba67d0b46520 100644
--- a/content/browser/web_contents/render_view_host_manager.cc
+++ b/content/browser/web_contents/render_view_host_manager.cc
@@ -8,6 +8,7 @@
#include "base/command_line.h"
#include "base/logging.h"
+#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/debugger/devtools_manager_impl.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/renderer_host/render_view_host_factory.h"
@@ -846,6 +847,24 @@ RenderViewHostImpl* RenderViewHostManager::UpdateRendererStateForNavigate(
}
// Otherwise, it's safe to treat this as a pending cross-site transition.
+
+ if (entry.GetHasPostData()) {
+ ChildProcessSecurityPolicyImpl* policy =
michaeln 2012/10/23 23:22:18 Is the 'policy' thread safe? Just checking because
irobert 2012/11/01 19:26:31 Not quite sure about it. But i do believe this cou
Charlie Reis 2012/11/05 16:21:40 From the header file: "ChildProcessSecurityPolicy
irobert 2012/11/05 17:26:52 I have verified this with Darin. He mentioned: "It
+ ChildProcessSecurityPolicyImpl::GetInstance();
+ int oldID = render_view_host_->GetSiteInstance()->GetProcess()->GetID();
+ int newID = pending_render_view_host_->GetSiteInstance()->GetProcess()->GetID();
+ std::vector<content::WebHTTPPOSTBodyParams> post_data = entry.post_data;
+ for (std::vector<content::WebHTTPPOSTBodyParams>::iterator it=post_data.begin();
+ it < post_data.end(); it++) {
+ if ((*it).type == content::WebHTTPPOSTBodyParams::TypeFile) {
+ FilePath file = FilePath((*it).filePath);
+ if (policy->CanReadFile(oldID, file)) {
+ policy->GrantReadFile(newID, file);
+ }
+ }
+ }
+ }
+
// Make sure the old render view stops, in case a load is in progress.
render_view_host_->Send(
new ViewMsg_Stop(render_view_host_->GetRoutingID()));

Powered by Google App Engine
This is Rietveld 408576698