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

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

Issue 2006653005: Fix bug where a second CSP without script-src would cause failure (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Address estark's comments Created 4 years, 7 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 | « third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp ('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 71b01c8aaf560a5c8ef420f5fb029ad373eaff51..2fa82b78f4880dc1eca819c39ba992077ea1d8de 100644
--- a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
@@ -391,7 +391,7 @@ bool isAllowedByAllWithContextAndContent(const CSPDirectiveListVector& policies,
return isAllowed;
}
-template<bool (CSPDirectiveList::*allowed)(const String&) const>
+template<CSPDirectiveList::NoncePolicyDisposition (CSPDirectiveList::*allowed)(const String&) const>
bool isAllowedByAllWithNonce(const CSPDirectiveListVector& policies, const String& nonce)
{
bool isExplicitlyAllowed = false;
@@ -402,9 +402,11 @@ bool isAllowedByAllWithNonce(const CSPDirectiveListVector& policies, const Strin
// better fix would be to delay the nonce processing until such time as the whitelist
// processing fails. https://crbug.com/611652
if (policy.get()->headerType() == ContentSecurityPolicyHeaderTypeEnforce) {
- if (!(policy.get()->*allowed)(nonce))
+ CSPDirectiveList::NoncePolicyDisposition policyDisposition = (policy.get()->*allowed)(nonce);
+ if (policyDisposition == CSPDirectiveList::NoncePolicyDisposition::Denied)
return false;
- isExplicitlyAllowed = true;
+ if (policyDisposition == CSPDirectiveList::NoncePolicyDisposition::Allowed)
+ isExplicitlyAllowed = true;
}
}
return isExplicitlyAllowed;
« no previous file with comments | « third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698