Commit 192afe57 authored by tsepez@chromium.org's avatar tsepez@chromium.org

Don't include trailing comment characters in javascript snippets.

This trailing "/*" (and so forth) do not contribute very much to the signal, and not using them allows us to
catch some interesting corner cases involving server-side page post-processors.

BUG=355479

Review URL: https://codereview.chromium.org/210033008

git-svn-id: svn://svn.chromium.org/blink/trunk@169967 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent f846f5a4
CONSOLE ERROR: line 4: The XSS Auditor refused to execute a script in 'http://localhost:8000/security/xssAuditor/resources/echo-intertag.pl?clutter=/*]]%3E*/&q=%3Cscript%3E/*%3C!CDATA[*/alert(/XSS/)&q2=%3C/script%3E' because its source code was found within the request. The auditor was enabled as the server sent neither an 'X-XSS-Protection' nor 'Content-Security-Policy' header.
<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.setXSSAuditorEnabled(true);
}
</script>
</head>
<body>
<iframe src="http://localhost:8000/security/xssAuditor/resources/echo-intertag.pl?clutter=/*]]>*/&q=<script>/*<!CDATA[*/alert(/XSS/)&q2=</script>">
</iframe>
</body>
</html>
...@@ -696,12 +696,9 @@ String XSSAuditor::decodedSnippetForJavaScript(const FilterTokenRequest& request ...@@ -696,12 +696,9 @@ String XSSAuditor::decodedSnippetForJavaScript(const FilterTokenRequest& request
lastNonSpacePosition = kNotFound; lastNonSpacePosition = kNotFound;
for (foundPosition = startPosition; foundPosition < endPosition; foundPosition++) { for (foundPosition = startPosition; foundPosition < endPosition; foundPosition++) {
if (!request.shouldAllowCDATA) { if (!request.shouldAllowCDATA) {
if (startsSingleLineCommentAt(string, foundPosition) || startsMultiLineCommentAt(string, foundPosition)) { if (startsSingleLineCommentAt(string, foundPosition)
foundPosition += 2; || startsMultiLineCommentAt(string, foundPosition)
break; || startsHTMLCommentAt(string, foundPosition)) {
}
if (startsHTMLCommentAt(string, foundPosition)) {
foundPosition += 4;
break; break;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment