VueJS – 清理输出以防止跨站点脚本攻击

huangapple go评论59阅读模式
英文:

VueJS - sanitizing output to prevent cross-site scripting attacks

问题

我是VueJS的新手。我开始学习关于v-html指令的内容。
我的问题是:如何对输出进行清理以防止跨站脚本攻击?

英文:

I'm new to VueJS. I start learning about the v-html directive.
My question is: how to sanitize output to prevent cross-site scripting attacks?

答案1

得分: 1

你可以使用https://www.npmjs.com/package/vue-sanitize来进行这种类型的操作,但请注意攻击面可能会根据您的需求和对v-html的使用方式而有所不同,存在许多攻击方式,例如在img的错误事件上运行脚本,base64编码的脚本等等...
因此,在使用v-html时要小心谨慎。

英文:

you can use https://www.npmjs.com/package/vue-sanitize for this kind of purposes, but consider that the attack surface may vary based on what you need and what you want to do with v-html, and there are alot of attack ways like add script running on img on error , base64 coded scripts and so on...
so be carefull about using v-html.

huangapple
  • 本文由 发表于 2020年1月3日 17:09:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/59575737.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定