Welcome Guest, Not a member yet? Register   Sign In
Question about CI XSS filter and HTMLPurifier
#1

(This post was last modified: 06-01-2015, 02:45 PM by Mel9pr.)

I use tinymce on my textarea input forms to make easy to add basic things like links, formated text, colored text and so on.

Because we are not suppose to use CI XSS filter on the input but on the output instead I do something like this to output textarea data;

Code:
$textarea_data = $this->security->xss_clean($textarea_data_from_database);
echo $text_area_data;

Because I am worry about MySql injections I use HTMLPurifier to input textarea data like this:

Code:
$input_textarea_data = html_purify($this->input->post($input_textarea_data));

because I can not use CI input validation with a WYSIWYG editor (Am I right?) so I use HTMLPurifier instead.

My questions are...

Could CI XSS filter alter or neutralize HTMLPurifier's protection?

or

Must I avoid CI XSS filter to output HTMLPurifier filtered data?

Thanks!
Reply
#2

You clearly don't properly understand XSS and SQL injections. They are separate things. What you are doing now is applying xss filter for both input and output, so you are escaping data twice - you are going to have a bad time if you do this. Instead, you should use xss filter on output and on input use CI's query builder and/or prepared statements.
Quote:because I can not use CI input validation with a WYSIWYG editor (Am I right?) so I use HTMLPurifier instead.
I don't see a reason why you can't use normal validation. WYSIWYG editor sends data as a normal form data.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB