finish cabalizing package

This commit is contained in:
Greg Weber 2010-09-25 13:31:37 -07:00
parent 632edcd7fc
commit c9765daaed
3 changed files with 12 additions and 11 deletions

View File

@ -1,16 +1,14 @@
module Text.HTML.SanitizeXSS where
import Data.Set (Set(..), member, notMember, fromList)
import Network.URI ( parseURIReference, URI (..) )
import Data.Char ( toLower, isLower, isUpper, isAlpha, isAscii,
isLetter, isDigit )
import Network.URI ( isAllowedInURI, escapeURIString, unEscapeString, uriScheme )
import Codec.Binary.UTF8.String ( encodeString, decodeString )
import Text.HTML.TagSoup
import Data.Set (Set(), member, fromList)
import Data.Char ( toLower, isAscii )
import Network.URI ( parseURIReference, URI (..),
isAllowedInURI, escapeURIString, unEscapeString, uriScheme )
import Codec.Binary.UTF8.String ( encodeString, decodeString )
sanitizeXSS :: String -> String
sanitizeXSS = renderTagsOptions renderOptions {
optMinimize = \x -> x `elem` ["br","img"]

View File

@ -4,4 +4,5 @@ main = do
let test = " <a href='unsafe://hack.com'>anchor</a> <img src='evil://evil.com' /> <unsafe></foo> <bar /> <br></br> "
let actual = (sanitizeXSS test)
let expected = " <a>anchor</a> <img /> <br /> "
putStrLn $ if actual == expected then "pass" else "failure parsing:" ++ (show test) ++ "\nexpected:" ++ (show expected) ++ "\nactual: " ++ (show actual)
putStrLn $ "testing: " ++ test
putStrLn $ if actual == expected then "pass" else "failure\n" ++ "\nexpected:" ++ (show expected) ++ "\nactual: " ++ (show actual)

View File

@ -14,7 +14,9 @@ build-type: Simple
homepage: http://github.com/gregwebs/haskell-xss-sanitize
library
build-depends: tagsoup >= 0.11
build-depends: base == 4.*, containers,
tagsoup >= 0.11, utf8-string >= 0.3, network >= 2
exposed-modules: Text.HTML.SanitizeXSS
ghc-options: -Wall