Skip to content

Latest commit

 

History

History
49 lines (35 loc) · 2.48 KB

File metadata and controls

49 lines (35 loc) · 2.48 KB

Getting Started

Getting the JARs

If you are using Maven then follow the maven directions to add a dependency. Otherwise, download prebuilt jars or git clone git@github.com:OWASP/java-html-sanitizer.git and build the latest source.

Unless maven is managing your CLASSPATH for you, you need to add owasp-java-html-sanitizer.jar.

Once you have your CLASSPATH set up correctly with the relevant JARs you should be able to add

import org.owasp.html.HtmlPolicyBuilder;

to one of your project's .java files and compile it.

Using the APIs

The examples include source code which defines a sanitization policy, and applies it to HTML. They are sample source to read and copy into your own project, not classes in the jar: there is nothing under org.owasp.html.examples to import.

The javadoc covers more detailed topics, including customization.

Important classes are:

For advanced use, see:

Asking Questions

Feel free to post questions in GitHub Discussions and we'll do our best to help.