Bre*_*ako 3 javascript xss angularjs
We are using Angular JS in our app. I want to prevent all input fields from accepting JavaScript etc. Rather than check every single component is there a directive or something I could use out of the box which does this for me? Thanks
我不会做客户端过滤,而是将其留给服务器端组件.但是为了用户友好,客户端需要进行输入验证.
角度1.2.0(以及一些早期版本)中的ngSanitize可以帮助您清理输入.
http://docs.angularjs.org/api/ngSanitize
或者,编写您自己的过滤器,通过正则表达式运行输入以删除所有HTML/JS /等.
作为一个注释,您仍然应该让服务器清理输入,同时考虑用户可以针对您的服务器API发出直接请求,并且您可能没有客户端验证.
归档时间: |
|
查看次数: |
4953 次 |
最近记录: |