当前位置: 首页 > Web前端 > HTML

webxss攻击常见解决方法

时间:2023-04-02 12:37:33 HTML

webxss攻击常见解决方法1.https://jsxss.com/zh/options....js-xss可以过滤标签的所有属性,只显示文本2.标签过滤varhtml=filterXSS(contentValue,{onTag:function(tag,html,options){console.log(tag,html,options)if(tag==='script'){returnfilterXSS(html);}else{//nottrue其属性列表被过滤returnhtml}}});3、白名单过滤varhtml=filterXSS(contentValue,{whiteList:{span:['style'],div:['style'],p:['style'],b:['style'],strong:['风格']}});