在我的项目中每次安装新的 NPM 模块后,我都会收到以下错误:
[!] 40 vulnerabilities found - Packages audited: 5840 (0 dev, 299 optional)
Severity: 8 Low | 24 Moderate | 8 High
然后我跑npm audit
我获取了 40 个漏洞的详细信息,例如:
# Run npm install [email protected] /cdn-cgi/l/email-protection to resolve 22 vulnerabilities
SEMVER WARNING: Recommended action is a potentially breaking change
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate │ Prototype pollution │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ hoek │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ npm │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ npm > libcipm > npm-lifecycle > node-gyp > request > hawk > │
│ │ boom > hoek │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://nodesecurity.io/advisories/566 │
└───────────────┴──────────────────────────────────────────────────────────────┘
或这个 :
# Run npm update fsevents --depth 2 to resolve 3 vulnerabilities
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low │ Regular Expression Denial of Service │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ debug │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ chokidar │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ chokidar > fsevents > node-pre-gyp > tar-pack > debug │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://nodesecurity.io/advisories/534 │
└───────────────┴──────────────────────────────────────────────────────────────┘
所以我跑npm install [email protected] /cdn-cgi/l/email-protection
(尽管我已经有 6.0.1)然后npm update fsevents --depth 2
但之后我重新运行npm audit
一切都没有改变,我仍然有 40 个相同的漏洞,其中一些真的很可怕。我应该怎么办 ?
这在 MacOS 上对我有用:
- 将 NPM 更新到新的 6.1.0。它引入了“npmauditfix”命令,更多信息在这里 https://github.com/npm/npm/releases.
- 运行“npm 审核修复”。
当您再次运行“npmaudit”时,剩下的唯一漏洞应该是“手动审查”问题。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)