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

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

Issue 1620393002: Fix hyphen disallowed in Suborigin names (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Rebase on ToT 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
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-valid-names-expected.txt ('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/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 f9b8b64b0551d3be02df6cca138f60331b40b5e7..4a0915fe03ff304d9f9ea09cdd68f5aa7dda286c 100644
--- a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
@@ -34,6 +34,11 @@ String getSha256String(const String& content)
return "sha256-" + base64Encode(reinterpret_cast<char*>(digest.data()), digest.size(), Base64DoNotInsertLFs);
}
+template<typename CharType> inline bool isASCIIAlphanumericOrHyphen(CharType c)
+{
+ return isASCIIAlphanumeric(c) || c == '-';
+}
+
} // namespace
CSPDirectiveList::CSPDirectiveList(ContentSecurityPolicy* policy, ContentSecurityPolicyHeaderType type, ContentSecurityPolicyHeaderSource source)
@@ -719,7 +724,7 @@ String CSPDirectiveList::parseSuboriginName(const String& policy)
const UChar* begin = position;
- skipWhile<UChar, isASCIIAlphanumeric>(position, end);
+ skipWhile<UChar, isASCIIAlphanumericOrHyphen>(position, end);
if (position != end && !isASCIISpace(*position)) {
m_policy->reportInvalidSuboriginFlags("Invalid character \'" + String(position, 1) + "\' in suborigin.");
return String();
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-valid-names-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698