Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VueJS - sanitizing output to prevent cross-site scripting attacks

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?

like image 844
Adele Avatar asked Nov 19 '25 12:11

Adele


1 Answers

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.

like image 194
SeyyedKhandon Avatar answered Nov 22 '25 01:11

SeyyedKhandon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!