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

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

Issue 2002003002: Generate CSP violation reports for 'block-all-mixed-content' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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: third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
diff --git a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
index 95da7c8c41efdbdb04b95ea8411ba67430980a6d..5cef2cc79cb0fd6fc503168c23c1f60b155368df 100644
--- a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
@@ -140,6 +140,11 @@ bool CSPDirectiveList::checkDynamic(SourceListDirective* directive) const
return !directive || directive->allowDynamic();
}
+void CSPDirectiveList::reportMixedContent(const KURL& mixedURL) const
+{
+ m_policy->reportViolation(ContentSecurityPolicy::BlockAllMixedContent, ContentSecurityPolicy::BlockAllMixedContent, String(), mixedURL, m_reportEndpoints, m_header, ContentSecurityPolicy::URLViolation);
+}
+
bool CSPDirectiveList::checkSource(SourceListDirective* directive, const KURL& url, ContentSecurityPolicy::RedirectStatus redirectStatus) const
{
// If |url| is empty, fall back to the policy URL to ensure that <object>'s
@@ -640,18 +645,17 @@ void CSPDirectiveList::treatAsPublicAddress(const String& name, const String& va
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);
+
+ m_strictMixedContentCheckingEnforced = true;
+
+ if (!m_reportOnly)
+ m_policy->enforceStrictMixedContentChecking();
}
void CSPDirectiveList::enableInsecureRequestsUpgrade(const String& name, const String& value)

Powered by Google App Engine
This is Rietveld 408576698