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

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 2075273002: Resource requests from Save-Page-As should go through CanRequestURL checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated docs. Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1880 // Since we're just saving some resources we need, disallow downloading. 1880 // Since we're just saving some resources we need, disallow downloading.
1881 ResourceRequestInfoImpl* extra_info = 1881 ResourceRequestInfoImpl* extra_info =
1882 CreateRequestInfo(child_id, render_view_route_id, 1882 CreateRequestInfo(child_id, render_view_route_id,
1883 render_frame_route_id, false, context); 1883 render_frame_route_id, false, context);
1884 extra_info->AssociateWithRequest(request.get()); // Request takes ownership. 1884 extra_info->AssociateWithRequest(request.get()); // Request takes ownership.
1885 1885
1886 std::unique_ptr<ResourceHandler> handler(new SaveFileResourceHandler( 1886 std::unique_ptr<ResourceHandler> handler(new SaveFileResourceHandler(
1887 request.get(), save_item_id, save_package_id, child_id, 1887 request.get(), save_item_id, save_package_id, child_id,
1888 render_frame_route_id, url, save_file_manager_.get())); 1888 render_frame_route_id, url, save_file_manager_.get()));
1889 1889
1890 // Check if the renderer is permitted to request the requested URL.
1891 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL(child_id,
1892 url)) {
1893 VLOG(1) << "Denied unauthorized save of " << url.possibly_invalid_spec();
Randy Smith (Not in Mondays) 2016/07/21 19:29:54 Reasonable to make this a DVLOG? I don't think th
Łukasz Anforowicz 2016/07/21 23:44:30 Done. Note that we have a VLOG for other similar
1894 handler->OnResponseCompleted(
1895 net::URLRequestStatus::FromError(net::ERR_ACCESS_DENIED),
1896 "", // |security_info|; ignored by SaveFileResourceHandler.
1897 nullptr); // |defer|; ignored by SaveFileResourceHandler.
mmenke 2016/07/21 19:38:43 This seems kind of hideous. ResourceDispatcherHos
Randy Smith (Not in Mondays) 2016/07/21 19:52:53 You're right. Mea culpa. (Mind you, this is a st
Łukasz Anforowicz 2016/07/21 23:44:30 Thanks for raising this up. I thought that it mig
mmenke 2016/07/22 00:12:16 The method is inherited from content::ResourceHand
1898 return;
1899 }
1900
1890 BeginRequestInternal(std::move(request), std::move(handler)); 1901 BeginRequestInternal(std::move(request), std::move(handler));
1891 } 1902 }
1892 1903
1893 void ResourceDispatcherHostImpl::MarkAsTransferredNavigation( 1904 void ResourceDispatcherHostImpl::MarkAsTransferredNavigation(
1894 const GlobalRequestID& id, 1905 const GlobalRequestID& id,
1895 const scoped_refptr<ResourceResponse>& response) { 1906 const scoped_refptr<ResourceResponse>& response) {
1896 GetLoader(id)->MarkAsTransferring(response); 1907 GetLoader(id)->MarkAsTransferring(response);
1897 } 1908 }
1898 1909
1899 void ResourceDispatcherHostImpl::CancelTransferringNavigation( 1910 void ResourceDispatcherHostImpl::CancelTransferringNavigation(
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
2596 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id); 2607 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id);
2597 response->head.security_info = SerializeSecurityInfo(ssl); 2608 response->head.security_info = SerializeSecurityInfo(ssl);
2598 } 2609 }
2599 2610
2600 CertStore* ResourceDispatcherHostImpl::GetCertStore() { 2611 CertStore* ResourceDispatcherHostImpl::GetCertStore() {
2601 return cert_store_for_testing_ ? cert_store_for_testing_ 2612 return cert_store_for_testing_ ? cert_store_for_testing_
2602 : CertStore::GetInstance(); 2613 : CertStore::GetInstance();
2603 } 2614 }
2604 2615
2605 } // namespace content 2616 } // namespace content
OLDNEW
« content/browser/download/docs/save-page-as.md ('K') | « content/browser/download/save_types.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698