RAA - whitewash/2.0

whitewash / 2.0

Short description: Whitelist-based HTML filter
Category: Library/HTML
Status: stable
Created: 2010-03-14 15:58:51 GMT
Last update: 2012-02-05 13:13:46 GMT
Owner: Dmitry Borodaenko (Projects of this owner)
Homepage: http://samizdat.nongnu.org/
Download: http://savannah.nongnu.org/download/samizdat/whitewash-2.0.tar.gz
License: GPL
Dependency:
Requires: nokogiri/1.5.0
Description:

Whitewash is a whitelist-based HTML filter for Ruby, based on HTML Tidy and REXML. It allows Ruby programs to clean up any HTML document or fragment coming from an untrusted source and to remove all dangerous constructs that could be used for cross-site scripting or request forgery. Whitewash was used in the Samizdat open publishing engine since 2004, and now it's released as a stand-alone module ready for use in other applications.

All HTML tags, attribute names and values, and CSS properties are filtered through a whitelist that defines which names and what kinds of values are allowed, everything that doesn't match the whitelist is removed.

The whitelist is provided externally, default whitelist is loaded from the whitelist.yaml shipped with Whitewash. The default is most strict (for example, it does not allow cross-site links to images in IMG tags) and can be considered safe for all uses. If you find that it lets anything exploitable through, please report it as a bug to Whitewash developers.

Whitewash relies on REXML to parse HTML and put it back together, and uses HTML Tidy (optionally via Ruby/Tidy library) to transform arbitrary HTML into valid XHTML that REXML can understand.

Versions: [2.0 (2012-02-05)] [1.0 (2010-03-14)]

Edit this project (for project owner)

back to RAA top