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

Unified Diff: Source/core/html/parser/XSSAuditor.cpp

Issue 1167763002: Make XSSAuditor aware of ECMA6 template strings. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Typo Created 5 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 | « LayoutTests/http/tests/security/xssAuditor/script-tag-with-injected-template-string-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/parser/XSSAuditor.cpp
diff --git a/Source/core/html/parser/XSSAuditor.cpp b/Source/core/html/parser/XSSAuditor.cpp
index a4876ec71f558c8a103f6590f09de34ba0e9ee6f..0f27adb9a2702709f91855b56171c88164cd807f 100644
--- a/Source/core/html/parser/XSSAuditor.cpp
+++ b/Source/core/html/parser/XSSAuditor.cpp
@@ -756,8 +756,9 @@ String XSSAuditor::canonicalizedSnippetForJavaScript(const FilterTokenRequest& r
String result;
while (startPosition < endPosition && !result.length()) {
// Stop at next comment (using the same rules as above for SVG/XML vs HTML), when we encounter a comma,
- // when we hit an opening <script> tag, or when we exceed the maximum length target. The comma rule
- // covers a common parameter concatenation case performed by some web servers.
+ // when we encoutner a backtick, when we hit an opening <script> tag, or when we exceed the maximum length
+ // target. The comma rule covers a common parameter concatenation case performed by some web servers. The
+ // backtick rule covers the ECMA6 multi-line template string feature.
lastNonSpacePosition = kNotFound;
for (foundPosition = startPosition; foundPosition < endPosition; foundPosition++) {
if (!request.shouldAllowCDATA) {
@@ -767,7 +768,7 @@ String XSSAuditor::canonicalizedSnippetForJavaScript(const FilterTokenRequest& r
break;
}
}
- if (string[foundPosition] == ',')
+ if (string[foundPosition] == ',' || string[foundPosition] == '`')
break;
if (lastNonSpacePosition != kNotFound && startsOpeningScriptTagAt(string, foundPosition)) {
« no previous file with comments | « LayoutTests/http/tests/security/xssAuditor/script-tag-with-injected-template-string-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698