赞
踩
1.对于不稳定的图片资源,使用一张图片加以替换
2.解决安全问题,对于“Web 应用程序包含了不存在的域的链接”的安全错误,在appscan扫描时往往会遇到
npm i bundle-url-check-loader -D
对你有帮助的话可以star一下
AST
1.例如,遇到项目bundle中存在不安全(不可访问)的链接,webpack.config.js传url为空,即可将其删除,url则是编写对应的正则表达式去匹配不安全(不可访问)的链接
const checkAUrlList = [
"http://schemas.microsoft.com/office/excel/2006/main",
"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",
"https://zhihu.com",
];
for (let i = 0; i < 3; i++) {
var a = document.createElement("a");
a.setAttribute("href", checkAUrlList[i]);
a.innerHTML='URL';
document.getElementById("body").appendChild(a);
}
webpack.config.js
module.exports = { ... module: { rules: [ { test: /\.js$/, use:[{ loader:"bundle-url-check-loader", options:{ url:'', reg:[/^http[s]{0,1}:\/\/schemas\.\S*/] } }], }, ], }, }; ...
有什么使用上的问题或者有什么建议,可以留言
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。