Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
HTML and CSS sanitizer Erlang port and a command-line utility in OCaml
Branch: master
Pull request Compare This branch is 2 commits behind EchoTeam:master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
tests
CSS.ml
CSS_EscapeLexer.mll
CSS_EscapeParser.mly
CSS_Lexer.mll
CSS_Parser.mly
CSS_Types.ml
HE_Lexer.mll
HE_Parser.mly
LICENSE
META
Makefile
README
Sanitizer.ml
Sanitizer.mli
Wordbreak.ml
html_sanitizer.ml

README

1. COMPILING AND INSTALLING THE LIBRARY SYSTEM-WIDE

	make check
	make install-package

2. TESTING THE COMMAND-LINE

	$> make html_sanitizer
	$> ./html_sanitizer --level nanotext --string "<div>text <b>to be stripped</b><pre>off html</div>"

	text to be stripped
	off html

	$>

4. USING THE Sanitizer API

4.1 Have a look into Sanitizer.mli to see the external interface.

4.2 The simplest OCaml program:

  === test.ml ===
  let _ =
    let sanitizer = new Sanitizer.html_sanitizer Sanitizer.Aggressive in
    print_string (sanitizer#sanitize_string
			  "[<script>evil code</script>]\n"
			^ "[<b>safe bold sentence</b>]\n");
  === test.ml ===

 $> ocamlfind ocamlopt -package "ocaml-html-sanitizer" -linkpkg -o test test.ml
 $> ./test
 []
 [<b>safe bold sentence</b>]
 $>

Something went wrong with that request. Please try again.