运行建议的命令不会修复NPM漏洞

Ki *_*Jéy 18 fsevents node.js npm npm-audit

在我的项目中每次安装新的NPM模块后,我收到以下错误:

[!] 40 vulnerabilities found - Packages audited: 5840 (0 dev, 299 optional)
    Severity: 8 Low | 24 Moderate | 8 High
Run Code Online (Sandbox Code Playgroud)

然后我运行npm audit并获取40个漏洞中的每个漏洞的详细信息,例如:

# Run  npm install npm@6.0.1  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 Code Online (Sandbox Code Playgroud)

或这个 :

# 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                       ?
????????????????????????????????????????????????????????????????????????????????
Run Code Online (Sandbox Code Playgroud)

所以我跑npm install npm@6.0.1(虽然我已经有6.0.1)然后npm update fsevents --depth 2但是之后我重新运行npm audit并且没有任何改变,我仍然有相同的40个漏洞,其中一些非常可怕.我该怎么办 ?

小智 6

这在MacOS上对我有用:

  • 将NPM更新到新的6.1.0.它引入了'npm audit fix'命令,这里有更多信息.
  • 运行'npm audit fix'.

当您再次运行'npm audit'时,剩下的唯一漏洞应该是"手动审核"问题.