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

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

Issue 1486993002: Report "inline" or "eval" for non-fetch CSP violations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clarity. Created 5 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 | « third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
diff --git a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
index cb2a42ea2bf70b3d84f72c2792319eea1db45e52..630aba82540592027a145273720a2d546f16b6ea 100644
--- a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
@@ -724,8 +724,9 @@ static void gatherSecurityPolicyViolationEventData(SecurityPolicyViolationEventI
}
}
-void ContentSecurityPolicy::reportViolation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, const Vector<String>& reportEndpoints, const String& header, LocalFrame* contextFrame)
+void ContentSecurityPolicy::reportViolation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, const Vector<String>& reportEndpoints, const String& header, ViolationType violationType, LocalFrame* contextFrame)
{
+ ASSERT(violationType == URLViolation || blockedURL.isEmpty());
ASSERT((m_executionContext && !contextFrame) || (equalIgnoringCase(effectiveDirective, ContentSecurityPolicy::FrameAncestors) && contextFrame));
// FIXME: Support sending reports from worker.
@@ -768,7 +769,17 @@ void ContentSecurityPolicy::reportViolation(const String& directiveText, const S
cspReport->setString("violated-directive", violationData.violatedDirective());
cspReport->setString("effective-directive", violationData.effectiveDirective());
cspReport->setString("original-policy", violationData.originalPolicy());
- cspReport->setString("blocked-uri", violationData.blockedURI());
+ switch (violationType) {
+ case InlineViolation:
+ cspReport->setString("blocked-uri", "inline");
+ break;
+ case EvalViolation:
+ cspReport->setString("blocked-uri", "eval");
+ break;
+ case URLViolation:
+ cspReport->setString("blocked-uri", violationData.blockedURI());
+ break;
+ }
if (!violationData.sourceFile().isEmpty() && violationData.lineNumber()) {
cspReport->setString("source-file", violationData.sourceFile());
cspReport->setNumber("line-number", violationData.lineNumber());
« no previous file with comments | « third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698