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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/security/xssAuditor/resources/echo-intertag-addslashes.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 4
5 my $cgi = new CGI; 5 my $cgi = new CGI;
6 6
7 sub addSlashes 7 sub addSlashes
8 { 8 {
9 my ($str) = @_; 9 my ($str) = @_;
10 $str =~ s/(['"\\])/\\$1/g; 10 $str =~ s/(['"\\])/\\$1/g;
11 $str =~ s/([\0])/\\0/g; 11 $str =~ s/([\0])/\\0/g;
12 return $str; 12 return $str;
13 } 13 }
14 14
15 print "X-XSS-Protection: 1\n";
15 print "Content-Type: text/html; charset=UTF-8\n\n"; 16 print "Content-Type: text/html; charset=UTF-8\n\n";
16 17
17 print "<!DOCTYPE html>\n"; 18 print "<!DOCTYPE html>\n";
18 print "<html>\n"; 19 print "<html>\n";
19 print "<body>\n"; 20 print "<body>\n";
20 print addSlashes($cgi->param('q')); 21 print addSlashes($cgi->param('q'));
21 print "</body>\n"; 22 print "</body>\n";
22 print "</html>\n"; 23 print "</html>\n";
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698