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

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

Issue 2436003002: CSP: Add 'script-sample' to violation reports. (Closed)
Patch Set: Rebase Created 3 years, 10 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/SourceListDirective.cpp
diff --git a/third_party/WebKit/Source/core/frame/csp/SourceListDirective.cpp b/third_party/WebKit/Source/core/frame/csp/SourceListDirective.cpp
index 0a81bf5eac573291ba8cb145ce3b09a3b6648331..588723028776f05d74da2efb810aa7094509ed28 100644
--- a/third_party/WebKit/Source/core/frame/csp/SourceListDirective.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/SourceListDirective.cpp
@@ -29,6 +29,7 @@ SourceListDirective::SourceListDirective(const String& name,
m_allowEval(false),
m_allowDynamic(false),
m_allowHashedAttributes(false),
+ m_reportSample(false),
m_hashAlgorithmsUsed(0) {
Vector<UChar> characters;
value.appendTo(characters);
@@ -103,6 +104,12 @@ bool SourceListDirective::allowHashedAttributes() const {
return m_allowHashedAttributes;
}
+bool SourceListDirective::allowReportSample() const {
+ if (!m_policy->experimentalFeaturesEnabled())
+ return false;
+ return m_reportSample;
+}
+
bool SourceListDirective::isNone() const {
return !m_list.size() && !m_allowSelf && !m_allowStar && !m_allowInline &&
!m_allowHashedAttributes && !m_allowEval && !m_allowDynamic &&
@@ -211,6 +218,11 @@ bool SourceListDirective::parseSource(
return true;
}
+ if (equalIgnoringCase("'report-sample'", token)) {
+ addReportSample();
+ return true;
+ }
+
String nonce;
if (!parseNonce(begin, end, nonce))
return false;
@@ -560,6 +572,10 @@ void SourceListDirective::addSourceUnsafeHashedAttributes() {
m_allowHashedAttributes = true;
}
+void SourceListDirective::addReportSample() {
+ m_reportSample = true;
+}
+
void SourceListDirective::addSourceNonce(const String& nonce) {
m_nonces.insert(nonce);
}

Powered by Google App Engine
This is Rietveld 408576698