new test case
authorJoey Hess <joey@kodama.kitenet.net>
Sun, 10 Feb 2008 08:38:30 +0000 (03:38 -0500)
committerJoey Hess <joey@kodama.kitenet.net>
Sun, 10 Feb 2008 08:38:30 +0000 (03:38 -0500)
t/htmlize.t
t/javascript.mdwn [new file with mode: 0644]

index a9ccfedcbb184b9a31165b63d9009f012416cbf5..670500a6796970f0cb54bb51fee054d3ccd9a1d5 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 use warnings;
 use strict;
-use Test::More tests => 4;
+use Test::More tests => 5;
 use Encode;
 
 BEGIN { use_ok("IkiWiki"); }
@@ -19,3 +19,7 @@ is(IkiWiki::htmlize("foo", "mdwn", readfile("t/test1.mdwn")),
        "utf8; bug #373203");
 ok(IkiWiki::htmlize("foo", "mdwn", readfile("t/test2.mdwn")),
        "this file crashes markdown if it's fed in as decoded utf-8");
+my $ret=IkiWiki::htmlize("foo", "mdwn", readfile("t/javascript.mdwn"));
+ok($ret !~ /GOTCHA/,
+       "javascript.mdwn contains a number of attempts at getting
+       javascript that contains GOTCHA past the html sanitiser.");
diff --git a/t/javascript.mdwn b/t/javascript.mdwn
new file mode 100644 (file)
index 0000000..6a5805a
--- /dev/null
@@ -0,0 +1,2 @@
+<a href="javascript&#x3A;alert('GOTCHA')">click me</a>
+<a href="javascript:alert('GOTCHA')">click me</a>