Reputation: 51
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?
Upvotes: 3
Views: 3237
Reputation: 6131
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.
Upvotes: 1