xss-html-filter

来源:互联网 发布:windows如何切换界面 编辑:程序博客网 时间:2024/06/03 14:52

  • View Source
  • Download (127K)

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 ofCal Henderson written in PHP.

Combined with this code is an inner Test class for unit testing, designed to be executed inJUnit 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 );