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

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

Issue 1178373004: 'blob:' URLs should not match 'self' in CSP source expression lists. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Exclude extensions. Created 5 years, 6 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
« no previous file with comments | « 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: Source/core/frame/csp/ContentSecurityPolicy.cpp
diff --git a/Source/core/frame/csp/ContentSecurityPolicy.cpp b/Source/core/frame/csp/ContentSecurityPolicy.cpp
index 9c6ccdf24fbfb02fba439c7df26c7cc19c738482..536a3ed9565b1a0b88153da84819477df705297a 100644
--- a/Source/core/frame/csp/ContentSecurityPolicy.cpp
+++ b/Source/core/frame/csp/ContentSecurityPolicy.cpp
@@ -953,6 +953,15 @@ bool ContentSecurityPolicy::protocolMatchesSelf(const KURL& url) const
return equalIgnoringCase(url.protocol(), m_selfProtocol);
}
+bool ContentSecurityPolicy::selfMatchesInnerURL() const
+{
+ // Due to backwards-compatibility concerns, we allow 'self' to match blob and filesystem URLs
+ // if we're in a context that bypasses Content Security Policy in the main world.
+ //
+ // TODO(mkwst): Revisit this once embedders have an opportunity to update their extension models.
+ return m_executionContext && SchemeRegistry::schemeShouldBypassContentSecurityPolicy(m_executionContext->securityOrigin()->protocol());
+}
+
bool ContentSecurityPolicy::shouldBypassMainWorld(const ExecutionContext* context)
{
if (context && context->isDocument()) {
« no previous file with comments | « Source/core/frame/csp/ContentSecurityPolicy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698