繁体   English   中英

react-icons 4.4.0 中的 6 个高严重性漏洞

[英]6 high severity vulnerabilities in react-icons 4.4.0

    # npm audit report

nth-check  <2.0.1
Severity: high
Inefficient Regular Expression Complexity in nth-check - https://github.com/advisories/GHSA-rp65-9cf3-cjxr
fix available via `npm audit fix --force`
Will install react-scripts@2.1.3, which is a breaking change
node_modules/svgo/node_modules/nth-check
  css-select  <=3.1.0
  Depends on vulnerable versions of nth-check
  node_modules/svgo/node_modules/css-select
    svgo  1.0.0 - 1.3.2
    Depends on vulnerable versions of css-select
    node_modules/svgo
      @svgr/plugin-svgo  <=5.5.0
      Depends on vulnerable versions of svgo
      node_modules/@svgr/plugin-svgo
        @svgr/webpack  4.0.0 - 5.5.0
        Depends on vulnerable versions of @svgr/plugin-svgo
        node_modules/@svgr/webpack
          react-scripts  >=2.1.4
          Depends on vulnerable versions of @svgr/webpack
          node_modules/react-scripts

6 high severity vulnerabilities

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

我正在使用 npm 8.12.1 和节点 16.15.1。 反应图标刚刚发布了它的 4.4.0,我试图安装它并最终出现在这条消息中。 我尝试了 npm audit fix --force。 脆弱性和严重性保持不变。 我想听听你对这条消息的看法。 因此,如果 react-icons 不安全,哪个包可以替代图标?

有类似的问题。 这有助于我理解。

https://github.com/facebook/create-react-app/issues/11174

编辑:

npm audit 在设计上被前端工具破坏了

更多阅读: https ://overreacted.io/npm-audit-broken-by-design/

Create React App 是一个构建工具。 换句话说,它不会生成运行中的 Node 应用程序。 它在开发期间的构建时运行,并生成静态资产。

但是,npm audit 是为 Node 应用程序设计的,因此它会标记在生产中运行实际 Node 代码时可能发生的问题。 这绝对不是 Create React App 的工作方式。

这意味着我们收到的关于传递依赖的绝大多数“漏洞”报告都是误报。 尽管在 react-scripts 中有数千条关于 npm 审计警告的评论,但实际上没有一个问题(据我们所知)对 CRA 用户来说是一个真正的漏洞。

如果您仍想修复警告:

打开 package.json。 你会发现这个:

"dependencies": { "react": "^17.0.2", "react-dom": "^17.0.2", "react-scripts": "4.0.3" }

获取 react-scripts 并将其移至 devDependencies(如果没有,请创建它):

"dependencies": { "react": "^17.0.2", "react-dom": "^17.0.2" }, "devDependencies": { "react-scripts": "4.0.3" },

然后,确保您运行npm audit --production而不是npm audit

这将修复您的警告。

并非所有漏洞都是相同的。 我有这个完全相同的错误,进一步的研究表明它很常见,并且 - 在我的情况下 - 它可以被忽略(使用npm view nth-check version显示我有一个比错误提示的更高版本,我不相信这个漏洞存在安全问题)

也不要盲目使用npm audit fix --force 例如,在我的情况下,它会强制降级nth-checkreact-scripts版本,这会引入可能更严重的漏洞。

对此的进一步研究表明,没有 0 个漏洞是很正常/常见的吗? 并且每个人都需要权衡您正在构建的东西的优点,因此很可能是个人研究决定。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM