![]() |
Form Validation and XSS filter... not working on onclick... - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Form Validation and XSS filter... not working on onclick... (/showthread.php?tid=26732) |
Form Validation and XSS filter... not working on onclick... - El Forum - 01-21-2010 [eluser]ururk[/eluser] I must be doing something wrong (CI - 1.7.2). This JS is getting through: Code: " onclick="alert('hi')" " Code: javascript (plus a colon) is removed. Setup: Search form (this is part of a view): Code: <label for="all_words">All these words</label> Validation rule: Code: function _validate_advanced() { Controller: Code: $this->_validate_advanced(); Any ideas? Form Validation and XSS filter... not working on onclick... - El Forum - 01-21-2010 [eluser]ururk[/eluser] Also, I need to explain the: Code: 'all_words' => html_entity_decode(set_value('all_words'), ENT_QUOTES, "UTF-8"), line. The database stores unencoded characters, so I need to search using decoded entities. Should I be encoding them in the database? Form Validation and XSS filter... not working on onclick... - El Forum - 01-22-2010 [eluser]ururk[/eluser] I basically am solving this by encoding the values before echoing them in the form fields. However, should an onclick or alert get through the XSS filter? |