1.

What is the security parameter for XSS in CodeIgniter?

Answer»
  • Codeigniter has got a Cross-Site SCRIPTING(XSS) hack prevention filter. This filter either automatically runs or you can run it based on item, to filter all data related to POST and COOKIE.
  • The XSS filter will target the frequently used METHODS to TRIGGER JavaScript code or other types of code that attempt to hijack cookies or do any other MALICIOUS activity. If it identifies anything suspicious or anything disallowed is encountered, then it will convert the data to character entities.
  • To filter data through the XSS filter, we will make use of the xss_clean() method as given below:
$data = $this->security->xss_clean($data);

This function is used only when you are submitting data. The second Boolean parameter is optional and used to check the image files for the XSS attacks. This is very useful for FILE upload. If its value is true, that means the image is safer and not otherwise.



Discussion

No Comment Found