VUE3前端代码打包后存在致命漏洞Credential Management:Hardcoded API Credentials (Critical)

代码:前端代码,VUE3编写

扫描工具:Fortify 23

扫描对象:打包后的dist文件夹

报错定位文件:js/chunk-vendors.xxxxx.js

初步分析:

1、chunk-vendors文件是node_modules中文件的压缩;

2、修改vue.config.js配置文件,重新打包,使得js/chunk-vendors.xxxxx.js文件换行,再次进行扫描,没有以上漏洞

// new TerserPlugin({
//     exclude: /node_modules/, // 确保 node_modules 不参与压缩
//     terserOptions: {
//         warnings: false, // 禁止警告输出
//         compress: {
//             drop_console: true, // 删除 console
//             drop_debugger: true, // 删除 debugger
//             pure_funcs: ['console.log'], // 只移除 console.log
//         },
//         // compress: false,
//     },
//     sourceMap: true, // 如果需要调试设置为 true
//     parallel: true, // 启用多线程压缩
// }),
 

3、那就针对以上注释掉的配置文件进行分析,分析后,主要修改了exclude这个配置项

new TerserPlugin({
    // TerserPlugin 的输入并不是项目中的原始文件,而是经过 Webpack 处理后生成的中间代码
    // 所以我这里不能写 /node_modules/
    exclude: /.*chunk-vendors.*/, 
    terserOptions: {
        warnings: false, // 禁止警告输出
        compress: {
            drop_console: true, // 删除 console
            drop_debugger: true, // 删除 debugger
            pure_funcs: ['console.log'], // 只移除 console.log
        },
        // compress: false,
    },
    sourceMap: false, // 如果需要调试设置为 true
    parallel: true, // 启用多线程压缩
    }),

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

扬子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值