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

标签 html vue.js ecmascript-6 cross-site vuejs3

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

最佳答案

您可以使用https://www.npmjs.com/package/vue-sanitize出于这种目的,但请考虑到攻击面可能会根据您的需要以及您想要对 v-html 执行的操作而有所不同,并且有很多攻击方式,例如在错误时添加在 img 上运行的脚本、base64 编码脚本和很快... 所以使用 v-html 时要小心。

关于html - VueJS - 清理输出以防止跨站点脚本攻击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59575737/

相关文章:

javascript - Redux ES6(BabelJS): is there a map function that can iterate this structure?

javascript - 当 html 中 DOM 完全加载时使用元素

javascript - 识别码和img src属性

javascript - 可以组合 apollo 查询(在 nuxt 内?)

javascript - ES6 JS 类下划线设置和获取方法返回 "Maximum call stack size exceeded"

Javascript 对象相互交叉引用

Javascript 按钮不应该显示引号

html - 可以在 iOS7 UIAlertView 中显示 html 内容吗?

javascript - 如何将一个 Vue 组件中的所有字段与另一个组件一起验证(使用 Vee-Validate)?

unit-testing - 如何在使用 vuex 模块时测试突变