HTML-Defang-1.08/0000755000000000000000000000000015103077723012073 5ustar rootrootHTML-Defang-1.08/META.json0000644000000000000000000000170015103077723013512 0ustar rootroot{ "abstract" : "Cleans HTML as well as CSS of scripting and other executable contents, and neutralises XSS attacks.", "author" : [ "Rob Mueller " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 7.64, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "HTML-Defang", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : {} } }, "release_status" : "stable", "version" : 1.08, "x_serialization_backend" : "JSON::PP version 4.07" } HTML-Defang-1.08/t/0000755000000000000000000000000015103077723012336 5ustar rootrootHTML-Defang-1.08/t/03_styles.t0000644000000000000000000005651215103075374014361 0ustar rootroot#!/usr/bin/perl -w BEGIN { # CPAN users don't have ME::*, so use eval eval 'use ME::FindLibs' } use Test::More tests => 93; use HTML::Defang; use strict; my ($Res, $H); my ($DefangString, $CommentStartText, $CommentEndText) = ('defang_', ' ', ' '); my $Defang = HTML::Defang->new(); $H = < body {color: black} EOF $Res = $Defang->defang($H); like($Res, qr{^$}s, "Simple style tag"); $H = < body {font-family: "sans\\0020serif"\\003b color\\003a black; } EOF $Res = $Defang->defang($H); like($Res, qr{^$}s, "Style tag with html and unicode entities"); $H = < p {font-family: "sans serif"} EOF $Res = $Defang->defang($H); like($Res, qr{^$}s, "Style tag property with quotes and space"); $H = < p {text-align:center;color:red} EOF $Res = $Defang->defang($H); like($Res, qr{^ $}s, "Multiple properties"); $H = < p { text-align: center; color: black; font-family: arial } EOF $Res = $Defang->defang($H); like($Res, qr{^ $}s, "Multiple properties in readable format"); $H = < h1,h2,h3,h4,h5,h6 { color: green } EOF $Res = $Defang->defang($H); like($Res, qr{^ $}s, "Multiple selectors"); $H = < p.right {text-align: right} p.center {text-align: center} EOF $Res = $Defang->defang($H); like($Res, qr{^ $}s, "Selector with a period"); $H = < .center {text-align: center} EOF $Res = $Defang->defang($H); like($Res, qr{^ $}, "Selector starting in a period"); $H = < input[type="text"] {background-color: blue} EOF $Res = $Defang->defang($H); like($Res, qr{^ $}s, "Selector with square brackets"); $H = < #green {color: green} EOF $Res = $Defang->defang($H); like($Res, qr{^ $}s, "Selector starting with a hash"); $H = < p#para1 { text-align: center; color: red } EOF $Res = $Defang->defang($H); like($Res, qr{^ $}s, "Selector with a hash"); $H = < /* This is a comment */ p { text-align: center; /* This is another comment */ color: black; font-family: arial /* Comment here */ }/* multi-line comment here */ EOF $Res = $Defang->defang($H); like($Res, qr{^ $}s, "All sorts of comments"); $H = < body {color: black} EOF $Res = $Defang->defang($H); like($Res, qr{^ $}s, "Missing closing style tag"); $H = < body, super, man, spider, man {1color: black; kulam : potta; valippam:2%;} abc {sup: s-up} li {list-style-image: url("javascript:alert('XSS')");} dinkiri/* some more */ dinkare EOF $Res = $Defang->defang($H); like($Res, qr{^ dinkiri/\* some more \*/ dinkare $}s, "Multiple style tags"); $H = <\@import'http://ha.ckers.org/xss.css'; EOF $Res = $Defang->defang($H); like($Res, qr{^$}s, "Remote style sheet part 2"); $H = <BODY{-moz-binding:url("http://ha.ckers.org/xssmoz.xml#xss")} EOF $Res = $Defang->defang($H); like($Res, qr{^$}s, "Remote style sheet part 4"); $H = <li {list-style-image: url("javascript:alert('XSS')");}