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

Unified Diff: Source/core/loader/FrameFetchContext.cpp

Issue 1010893003: Upgrade insecure requests: Pipe navigational hosts down into nested documents. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: MOARASSERT Created 5 years, 9 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
« no previous file with comments | « Source/core/frame/csp/ContentSecurityPolicyTest.cpp ('k') | Source/core/loader/FrameFetchContextTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/FrameFetchContext.cpp
diff --git a/Source/core/loader/FrameFetchContext.cpp b/Source/core/loader/FrameFetchContext.cpp
index e8735cd103ddb47506adffa15e0bce2bc4acd41d..605426e5bbced8384a65fa2300698c73acf8c4d3 100644
--- a/Source/core/loader/FrameFetchContext.cpp
+++ b/Source/core/loader/FrameFetchContext.cpp
@@ -633,16 +633,18 @@ void FrameFetchContext::upgradeInsecureRequest(FetchRequest& fetchRequest)
fetchRequest.mutableResourceRequest().addHTTPHeaderField("Prefer", "tls");
if (m_document->insecureRequestsPolicy() == SecurityContext::InsecureRequestsUpgrade && url.protocolIs("http")) {
- // We always upgrade subresource requests and nested frames, we always upgrade form
- // submissions, and we always upgrade requests whose host matches the host of the
- // containing document's security origin.
+ ASSERT(m_document->insecureNavigationsToUpgrade());
+
+ // We always upgrade requests that meet any of the following criteria:
//
- // FIXME: We need to check the document that set the policy, not the current document.
+ // 1. Are for subresources (including nested frames).
+ // 2. Are form submissions.
+ // 3. Whose hosts are contained in the document's InsecureNavigationSet.
const ResourceRequest& request = fetchRequest.resourceRequest();
if (request.frameType() == WebURLRequest::FrameTypeNone
|| request.frameType() == WebURLRequest::FrameTypeNested
|| request.requestContext() == WebURLRequest::RequestContextForm
- || url.host() == m_document->securityOrigin()->host())
+ || (!url.host().isNull() && m_document->insecureNavigationsToUpgrade()->contains(url.host().impl()->hash())))
{
url.setProtocol("https");
if (url.port() == 80)
« no previous file with comments | « Source/core/frame/csp/ContentSecurityPolicyTest.cpp ('k') | Source/core/loader/FrameFetchContextTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698