npm audit 在包 yarn 中找到漏洞为什么找不到
npm audit find vulnerability in package yarn why doesn't find
npm audit
(和Github)发现这个漏洞:
# Run npm update macaddress --depth 5 to resolve 1 vulnerability
Critical Command Injection
Package macaddress
Dependency of css-loader [dev]
Path css-loader > cssnano > postcss-filter-plugins > uniqid >
macaddress
More info https://nodesecurity.io/advisories/654
不仅 yarn audit
没有发现这个漏洞,yarn why
也不知道这样的依赖关系:
> yarn why macaddress
yarn why v1.12.3
[1/4] Why do we have the module "macaddress"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
error We couldn't find a match!
Done in 0.66s
它也没有找到 uniqid
但是它找到了 postcss-filter-plugins
。
谁能解释为什么 yarn
和 npm
似乎对依赖关系树中的内容有不同的看法?
Yarn audit 和 npm audit,两者都基于它们的锁定文件 package-lock.json for npm 和 yarn.lock for yarn.
如果您想要相同的结果,则应更新这两个文件。您需要 运行 npm install 和 yarn install 命令来获取更新的锁定文件。
目前好像只更新了一个,另一个已经过时了
npm audit
(和Github)发现这个漏洞:
# Run npm update macaddress --depth 5 to resolve 1 vulnerability
Critical Command Injection
Package macaddress
Dependency of css-loader [dev]
Path css-loader > cssnano > postcss-filter-plugins > uniqid >
macaddress
More info https://nodesecurity.io/advisories/654
不仅 yarn audit
没有发现这个漏洞,yarn why
也不知道这样的依赖关系:
> yarn why macaddress
yarn why v1.12.3
[1/4] Why do we have the module "macaddress"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
error We couldn't find a match!
Done in 0.66s
它也没有找到 uniqid
但是它找到了 postcss-filter-plugins
。
谁能解释为什么 yarn
和 npm
似乎对依赖关系树中的内容有不同的看法?
Yarn audit 和 npm audit,两者都基于它们的锁定文件 package-lock.json for npm 和 yarn.lock for yarn.
如果您想要相同的结果,则应更新这两个文件。您需要 运行 npm install 和 yarn install 命令来获取更新的锁定文件。
目前好像只更新了一个,另一个已经过时了