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

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

Issue 1187843005: XSSAuditor: Dont give a pass to subsequent script blocks if first one is empty. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 | « LayoutTests/http/tests/security/xssAuditor/script-tag-inside-svg-tag4-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 a1e1852201d23ac858c3b5065a2e26f52d128f4d..e73259145366c12c821a710fe83d3637529478ee 100644
--- a/Source/core/html/parser/XSSAuditor.cpp
+++ b/Source/core/html/parser/XSSAuditor.cpp
@@ -471,15 +471,18 @@ bool XSSAuditor::filterCharacterToken(const FilterTokenRequest& request)
if (m_state == PermittingAdjacentCharacterTokens)
return false;
- if ((m_state == SuppressingAdjacentCharacterTokens)
- || (m_scriptTagFoundInRequest && isContainedInRequest(canonicalizedSnippetForJavaScript(request)))) {
+ if (m_state == FilteringTokens && m_scriptTagFoundInRequest) {
+ String snippet = canonicalizedSnippetForJavaScript(request);
+ if (isContainedInRequest(snippet))
+ m_state = SuppressingAdjacentCharacterTokens;
+ else if (!snippet.isEmpty())
+ m_state = PermittingAdjacentCharacterTokens;
+ }
+ if (m_state == SuppressingAdjacentCharacterTokens) {
request.token.eraseCharacters();
request.token.appendToCharacter(' '); // Technically, character tokens can't be empty.
- m_state = SuppressingAdjacentCharacterTokens;
return true;
}
-
- m_state = PermittingAdjacentCharacterTokens;
return false;
}
« no previous file with comments | « LayoutTests/http/tests/security/xssAuditor/script-tag-inside-svg-tag4-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698