微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

preact-cli 具有高严重性漏洞,并且 npm 审计修复在圈子中运行 (3.0.5 <-> 2.2.1)

如何解决preact-cli 具有高严重性漏洞,并且 npm 审计修复在圈子中运行 (3.0.5 <-> 2.2.1)

我正在使用 preact-cli 设置一个 preact 项目:

npx --version # 7.4.0
npx preact-cli create typescript frontend

这告诉我:

...
added 1947 packages,and audited 1948 packages in 31s

129 packages are looking for funding
  run `npm fund` for details

3 high severity vulnerabilities

To address all issues (including breaking changes),run:
  npm audit fix --force

Run `npm audit` for details.
✔ Done!

刚刚运行认设置后的3个高安全漏洞!?
这听起来不太令人放心。

npm audit fix

...
fix available via `npm audit fix --force`
Will install preact-cli@2.2.1,which is a breaking change

好的,显然 npm fix 想要降级 preact-cli。那我们走吧:

npm audit fix --force

...

fix available via `npm audit fix --force`
Will install preact-cli@3.0.5,which is a breaking change
node_modules/preact-cli/node_modules/webpack-dev-server/node_modules/yargs-parser
node_modules/preact-cli/node_modules/yargs-parser
  yargs  4.0.0-alpha1 - 12.0.5 || 14.1.0 || 15.0.0 - 15.2.0
  Depends on vulnerable versions of os-locale
  Depends on vulnerable versions of yargs-parser
  node_modules/preact-cli/node_modules/webpack-dev-server/node_modules/yargs
  node_modules/preact-cli/node_modules/yargs
    preact-cli  1.0.0 - 3.0.0-next.3
    Depends on vulnerable versions of extract-text-webpack-plugin
    Depends on vulnerable versions of url-loader
    Depends on vulnerable versions of yargs
    node_modules/preact-cli
    webpack  2.1.0-beta.8 - 4.0.0-alpha.0
    Depends on vulnerable versions of yargs
    node_modules/preact-cli/node_modules/webpack
      extract-text-webpack-plugin  2.0.0-beta.0 - 3.0.2
      Depends on vulnerable versions of webpack
      node_modules/preact-cli/node_modules/extract-text-webpack-plugin
      webpack-dev-server  2.0.0-beta - 3.10.3
      Depends on vulnerable versions of webpack
      Depends on vulnerable versions of yargs
      node_modules/preact-cli/node_modules/webpack-dev-server

17 vulnerabilities (7 low,8 moderate,2 high)

是的,降级到 2.2.1 会引入新的漏洞。可以通过撤消降级并回到 3.0.5 来解决这些问题。

这是一个循环,npm audit fix --force只是在preact-cli的3.0.5和2.2.1版本之间来回切换。

一些背景: 这似乎是一个已知的 issue

解决方法

这里晚了(已在 ​​CLI 存储库上关闭)但对于上下文而言,2.2.1 现在已有几年历史了,依赖项是构建时的依赖项。构建时依赖没有风险,尤其是这个,因为它只是为了报告构建包大小的变化。

总是看看 npm audit 真正抱怨的是什么。如果它只是构建时的东西,你可以忽略它。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。