|
[Misc] PHP's filter extension and HTML Purifier February 21, 2007 09:26AM |
Registered: 6 years ago Posts: 4 |
Hello,
I have an other question. Can we used filter functions like filter_input, to prevenr a XSS attack ?
Or it's useless, to use filter_input for check and validate input date form external source?
Thanks for your answer.
Alexandre Joly.
Edited 1 time(s). Last edit at 04/02/2007 06:31AM by Ambush Commander.
|
Re: Use filter function ? February 21, 2007 04:21PM |
Admin Registered: 6 years ago Posts: 2,632 |
It depends on what you want to do. PHP's filter extension does not have HTML filtering built-in, so you'll have to use HTML Purifier for that job. For simpler datatypes, though, like integers, floating point numbers, email addresses, etc, filter's validation functions should be good enough for guarding against XSS.
Some people who believe in defense-in-depth would say that you should still htmlspecialchars() anything on the way out. Might not be a bad idea.
HTML Purifier, Standards Compliant HTML Filtering
|
Re: Use filter function ? February 21, 2007 05:25PM |
Registered: 6 years ago Posts: 4 |
|
Re: Use filter function ? February 25, 2007 03:57PM |
Admin Registered: 6 years ago Posts: 2,632 |
filter actually implements its email checking functionality with regexps. The trick is finding the right one! :-) Good call though: HTML Purifier can only validate HTML.
HTML Purifier, Standards Compliant HTML Filtering