PHP, Zend Framework and Other Crazy Stuff
HTML Purifier 2.0.0 – new version of the PHP HTML filter library
There are a lot of cool people on the PHP Developer Network forums. One of them is Edward Z. Yang.
On June 20th, Edward released HTML Purifier 2.0.0. HTML Purifier is a standards compliant HTML filter written in PHP. It uses a whitelisting approach and outputs standards compliant code, even if originally scrambled into an unintellible mess. It uses functionality in the background based on Tidy’s behaviour (so your preferred DTD is adhered to while filtering).
It’s purpose, in case you’re not familiar with HTML filter libraries, is to filter HTML user input to ensure it only includes whitelisted elements and attributes, and absolutely no XSS. The site contains a page dedicated to tests against the infamous http://ha.ckers.org/xss.html exploits. There’s even a demo page for testing it against your own possible exploits.
For my own part, HTML Purifier is probably the finest HTML filtering library in PHP at the moment. Its design is top notch, it’s a doddle to extend, and the API is intuitive for whitelisting (see the Advanced API). The library’s website has a stock of documentation for users and developers – including some useful tips for improving performance. Go get a copy and give it a whirl.
Related posts:
| Print article | This entry was posted by Pádraic Brady on June 26, 2007 at 4:28 pm, and is filed under PHP General, PHP Security. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
-
http://www.thebusypixel.com bucky
-
http://trophaeum.com/ Cameron Brunner
-
http://blog.astrumfutura.com Pádraic
-
http://www.trophaeum.com/ Cameron Brunner
-
http://htmlpurifier.org/ Edward Z. Yang
-
http://www.trophaeum.com/ Cameron Brunner
-
http://htmlpurifier.org/ Edward Z. Yang
-
http://www.hire-phpdeveloper.com Hire PHP Developer
