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

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

Issue 2551873003: Part 3.7: Is policy list subsumed under subsuming policy? (Closed)
Patch Set: Rebasing Created 4 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 | « no previous file | third_party/WebKit/Source/core/frame/csp/SourceListDirectiveTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 32d80712d5b24e88c3d1778f59421fb6ab4dccc5..669c0ccc7d0b5e5c16abc696bccfbda857fc83ea 100644
--- a/third_party/WebKit/Source/core/frame/csp/SourceListDirective.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/SourceListDirective.cpp
@@ -653,6 +653,19 @@ bool SourceListDirective::subsumes(
return false;
}
+ if (type == ContentSecurityPolicy::DirectiveType::ScriptSrc &&
+ (m_allowDynamic || allowDynamicOther)) {
+ // If `this` does not allow `strict-dynamic`, then it must be that `other`
+ // does allow, so the result is `false`.
+ if (!m_allowDynamic)
+ return false;
+ // All keyword source expressions have been considered so only CSPSource
+ // subsumption is left. However, `strict-dynamic` ignores all CSPSources so
+ // for subsumption to be true either `other` must allow `strict-dynamic` or
+ // have no allowed CSPSources.
+ return allowDynamicOther || !normalizedB.size();
+ }
+
return CSPSource::firstSubsumesSecond(normalizedA, normalizedB);
}
@@ -738,7 +751,7 @@ HeapVector<Member<CSPSource>> SourceListDirective::getIntersectCSPSources(
}
HeapVector<Member<CSPSource>> thisVector = m_list;
- if (m_allowSelf)
+ if (m_allowSelf && m_policy->getSelfSource())
thisVector.append(m_policy->getSelfSource());
for (const auto& sourceA : thisVector) {
if (schemesMap.contains(sourceA->getScheme()))
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/csp/SourceListDirectiveTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698