how to overcome xss_clean error in codeigniter?

扶醉桌前 提交于 2019-12-13 08:42:49

问题


Unable to access an error message corresponding to your field name Username.(xss_clean)

Unable to access an error message corresponding to your field name Email.(xss_clean)

Unable to access an error message corresponding to your field name Password.(xss_clean)

How to overcome errors corresponding to fields? "Unable to access an error message corresponding to your field" what is this exactly?


回答1:


Unable to access an error message corresponding to your field name Password.(xss_clean)

"Unable to access an error message corresponding to your field" what is this exactly?

Seems pretty self-explanatory. You're calling xss_clean as a validation rule, but there is no corresponding validation message for this.

Let me guess... you kept xss_clean within your validation rules because that's where it was used in your previous version of CodeIgniter, and you did not read the official CodeIgniter version 3 upgrade notes.

Step 13: Check for usage of the ‘xss_clean’ Form validation rule

A largely unknown rule about XSS cleaning is that it should only be applied to output, as opposed to input data.

We’ve made that mistake ourselves with our automatic and global XSS cleaning feature (see previous step about XSS above), so now in an effort to discourage that practice, we’re also removing ‘xss_clean’ from the officially supported list of form validation rules.

Because the Form Validation library generally validates input data, the ‘xss_clean’ rule simply doesn’t belong in it.

If you really, really need to apply that rule, you should now also load the Security Helper, which contains xss_clean() as a regular function and therefore can be also used as a validation rule.

More info here: forum.codeigniter.com/thread-1192.html



来源:https://stackoverflow.com/questions/45253878/how-to-overcome-xss-clean-error-in-codeigniter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!