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

Unified Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 2062523002: Fixing renderer's access to a file from HTTP POST (after a xsite transfer). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary logging + simplified condition of an "if" statement. Created 4 years, 6 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/loader/resource_dispatcher_host_impl.cc
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index 50153c6706bfa0951f8506161aa063702a7069b1..c14e80893b79a3f44d4995af6aad04b17a36b897 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -518,6 +518,16 @@ void NotifyForEachFrameFromUI(
base::Passed(std::move(routing_ids))));
}
+bool CanAccessFilesOfResourceRequestBody(
+ int child_id,
+ const scoped_refptr<ResourceRequestBody>& body) {
+ if (!body)
+ return true;
+
+ return ChildProcessSecurityPolicyImpl::GetInstance()->CanReadAllFiles(
+ child_id, body->GetReferencedFiles());
+}
+
} // namespace
LoaderIOThreadNotifier::LoaderIOThreadNotifier(WebContents* web_contents)
@@ -1380,6 +1390,16 @@ void ResourceDispatcherHostImpl::BeginRequest(
return;
}
+ // Reject requests attempting to refer to unauthorized files. This is
+ // important, because after a cross-site transfer, the new renderer process is
+ // unconditionally granted access to files from ResourceRequestBody.
+ if (!CanAccessFilesOfResourceRequestBody(child_id,
+ request_data.request_body)) {
+ bad_message::ReceivedBadMessage(
+ filter_, bad_message::RDH_CAN_ACCESS_FILES_OF_REQUEST_BODY);
+ return;
+ }
Łukasz Anforowicz 2016/06/14 01:07:17 AFAICT this check should cover all cases where Res
Charlie Reis 2016/06/16 20:22:11 Oh, we did catch it there. We get to ShouldServic
Łukasz Anforowicz 2016/06/16 22:05:04 Hmmm... I didn't previously look very hard how Sho
Charlie Reis 2016/06/16 22:19:59 Ok, I agree this whole thing is a bit confusing.
Łukasz Anforowicz 2016/06/16 23:33:55 Done. I think this is the right call - the new ki
+
// PlzNavigate: reject invalid renderer main resource request.
bool is_navigation_stream_request =
IsBrowserSideNavigationEnabled() &&

Powered by Google App Engine
This is Rietveld 408576698