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

Unified Diff: Source/core/frame/csp/CSPDirectiveList.cpp

Issue 811773002: Mixed Content: Implement strict mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Tests. Created 6 years 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/CSPDirectiveList.h ('k') | Source/core/frame/csp/ContentSecurityPolicy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/csp/CSPDirectiveList.cpp
diff --git a/Source/core/frame/csp/CSPDirectiveList.cpp b/Source/core/frame/csp/CSPDirectiveList.cpp
index bac990326d84ac7104b9d121391ae5a73ee46f5f..8f9c4f8349503c658768199baca05ca9a9985249 100644
--- a/Source/core/frame/csp/CSPDirectiveList.cpp
+++ b/Source/core/frame/csp/CSPDirectiveList.cpp
@@ -24,6 +24,7 @@ CSPDirectiveList::CSPDirectiveList(ContentSecurityPolicy* policy, ContentSecurit
, m_reflectedXSSDisposition(ReflectedXSSUnset)
, m_didSetReferrerPolicy(false)
, m_referrerPolicy(ReferrerPolicyDefault)
+ , m_strictMixedContentCheckingEnforced(false)
{
m_reportOnly = type == ContentSecurityPolicyHeaderTypeReport;
}
@@ -540,6 +541,22 @@ void CSPDirectiveList::applySandboxPolicy(const String& name, const String& sand
m_policy->reportInvalidSandboxFlags(invalidTokens);
}
+void CSPDirectiveList::enforceStrictMixedContentChecking(const String& name, const String& value)
+{
+ if (m_reportOnly) {
+ m_policy->reportInvalidInReportOnly(name);
+ return;
+ }
+ if (m_strictMixedContentCheckingEnforced) {
+ m_policy->reportDuplicateDirective(name);
+ return;
+ }
+ m_strictMixedContentCheckingEnforced = true;
+ m_policy->enforceStrictMixedContentChecking();
+ if (!value.isEmpty())
+ m_policy->reportValueForEmptyDirective(name, value);
+}
+
void CSPDirectiveList::parseReflectedXSS(const String& name, const String& value)
{
if (m_reflectedXSSDisposition != ReflectedXSSUnset) {
@@ -688,6 +705,8 @@ void CSPDirectiveList::addDirective(const String& name, const String& value)
} else if (m_policy->experimentalFeaturesEnabled()) {
if (equalIgnoringCase(name, ContentSecurityPolicy::ManifestSrc))
setCSPDirective<SourceListDirective>(name, value, m_manifestSrc);
+ else if (equalIgnoringCase(name, ContentSecurityPolicy::StrictMixedContentChecking))
+ enforceStrictMixedContentChecking(name, value);
else
m_policy->reportUnsupportedDirective(name);
} else {
« no previous file with comments | « Source/core/frame/csp/CSPDirectiveList.h ('k') | Source/core/frame/csp/ContentSecurityPolicy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698