【发布时间】:2021-08-04 22:53:12
【问题描述】:
我有一个使用 yarn 作为其包管理器的 React Native 项目 (0.61.4)。
当我运行yarn audit 时,报告了大量漏洞:
18202 vulnerabilities found - Packages audited: 958823
Severity: 18202 High
✨ Done in 14.34s.
大多数都在一些非常深的依赖路径中。例如:
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ high │ Prototype Pollution │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ lodash │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=4.17.12 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ react-native │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ react-native > @react-native-community/cli > │
│ │ metro-react-native-babel-transformer > @babel/core > lodash │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://www.npmjs.com/advisories/1065 │
└───────────────┴──────────────────────────────────────────────────────────────┘
当我运行npm audit 时,它首先报告:
Neither npm-shrinkwrap.json nor package-lock.json found: Cannot audit a project without a lockfile
所以我跑了:
npm i --package-lock-only
会生成一个package-lock.json 文件。经检查,此文件似乎正确。
当我现在运行npm audit 时,结果是:
=== npm audit security report ===
found 0 vulnerabilities
我不明白这两个包管理器之间的差异。为什么npm报错0,yarn报18.202?
【问题讨论】:
标签: node.js npm yarnpkg auditing