The Vue.js template has an unescaped variable. Untrusted user input passed to this variable results in Cross Site Scripting (XSS).
工具: SAST
扫描工具: njsscan
解决方法:
试过了 npm install dompurify,还是会被扫描工具判定XXS,最后换了一种方法
安装 vue-dompurify-html
npm install vue-dompurify-html
也可以使用淘宝镜像 npm install vue-dompurify-html --registry=https://registry.npmmirror.com
在main.js引入一下
import VueDOMPurifyHTML from 'vue-dompurify-html'
Vue.use(VueDOMPurifyHTML)
把所有的v-html替换掉
<div v-dompurify-html="yourHtml"></div>