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

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

Issue 1641533006: CSP: Add an experimental 'unsafe-dynamic' source expression. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Experiment. Created 4 years, 11 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 4a0915fe03ff304d9f9ea09cdd68f5aa7dda286c..280a00e946b7d47687df9ab1f13c6e96d28dec34 100644
--- a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
@@ -129,6 +129,11 @@ bool CSPDirectiveList::checkHash(SourceListDirective* directive, const CSPHashVa
return !directive || directive->allowHash(hashValue);
}
+bool CSPDirectiveList::checkDynamic(SourceListDirective* directive) const
+{
+ return !directive || directive->allowDynamic();
+}
+
bool CSPDirectiveList::checkSource(SourceListDirective* directive, const KURL& url, ContentSecurityPolicy::RedirectStatus redirectStatus) const
{
return !directive || directive->allows(url, redirectStatus);
@@ -412,6 +417,11 @@ bool CSPDirectiveList::allowStyleHash(const CSPHashValue& hashValue) const
return checkHash(operativeDirective(m_styleSrc.get()), hashValue);
}
+bool CSPDirectiveList::allowDynamic() const
+{
+ return checkDynamic(operativeDirective(m_scriptSrc.get()));
+}
+
const String& CSPDirectiveList::pluginTypesText() const
{
ASSERT(hasPluginTypes());
« no previous file with comments | « third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.h ('k') | third_party/WebKit/Source/core/frame/csp/CSPSourceList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698