xss-html-filter

黄向明
2023-12-01

This utility is a single class, HTMLInputFilter, which can be used to parse user-submitted input and sanitize it against potential cross site scripting attacks, malicious html, or simply badly formed html. This version, written in Java, is largely a translation of lib_filter, the original work of Cal Henderson written in PHP.

Combined with this code is an inner Test class for unit testing, designed to be executed in JUnit within Eclipse. The download archive includes the necessary JUnit jar for running the tests.

Processing HTML Input

Sample usage:

// retrieve input from user...
String input = ...
String clean = new HTMLInputFilter().filter( input );
 类似资料: