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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/security/xssAuditor/resources/echo-intertag-decode-16bit-unicode.pl

Issue 2524013002: XSS Auditor: Block by default. (Closed)
Patch Set: Rebase+Test Created 4 years 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/perl -wT 1 #!/usr/bin/perl -wT
2 use strict; 2 use strict;
3 use CGI; 3 use CGI;
4 use Encode; 4 use Encode;
5 5
6 my $cgi = new CGI; 6 my $cgi = new CGI;
7 7
8 use constant Unicode16BitEscapeSequenceLength => 6; # e.g. %u26C4 8 use constant Unicode16BitEscapeSequenceLength => 6; # e.g. %u26C4
9 my $unicode16BitEscapeSequenceRegEx = qr#%u([0-9A-Za-z]{1,4})#; 9 my $unicode16BitEscapeSequenceRegEx = qr#%u([0-9A-Za-z]{1,4})#;
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } 61 }
62 $result .= substr($string, $decodedPosition, $encodedRunPosition - $deco dedPosition); 62 $result .= substr($string, $decodedPosition, $encodedRunPosition - $deco dedPosition);
63 $result .= decodeRunOf16BitUnicodeEscapeSequences(substr($string, $encod edRunPosition, $encodedRunEndPosition - $encodedRunPosition)); 63 $result .= decodeRunOf16BitUnicodeEscapeSequences(substr($string, $encod edRunPosition, $encodedRunEndPosition - $encodedRunPosition));
64 $decodedPosition = $encodedRunEndPosition; 64 $decodedPosition = $encodedRunEndPosition;
65 } 65 }
66 $result .= substr($string, $decodedPosition); 66 $result .= substr($string, $decodedPosition);
67 return $result; 67 return $result;
68 } 68 }
69 69
70 my $charsetToUse = $cgi->param('charset') ? $cgi->param('charset') : "UTF-8"; 70 my $charsetToUse = $cgi->param('charset') ? $cgi->param('charset') : "UTF-8";
71 print "X-XSS-Protection: 1\n";
71 print "Content-Type: text/html; charset=$charsetToUse\n\n"; 72 print "Content-Type: text/html; charset=$charsetToUse\n\n";
72 73
73 print "<!DOCTYPE html>\n"; 74 print "<!DOCTYPE html>\n";
74 print "<html>\n"; 75 print "<html>\n";
75 print "<body>\n"; 76 print "<body>\n";
76 print decode16BitUnicodeEscapeSequences($cgi->param('q')); 77 print decode16BitUnicodeEscapeSequences($cgi->param('q'));
77 print "</body>\n"; 78 print "</body>\n";
78 print "</html>\n"; 79 print "</html>\n";
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698