create-react-app 由于react-scripts包的版本没有更新,导致该包存在关键漏洞,

vhipe2zx  于 8个月前  发布在  React
关注(0)|答案(7)|浏览(146)

描述bug

Yarn审计命令显示immer包存在关键漏洞:

  1. my-app % yarn audit --level critical
  2. yarn audit v1.22.10
  3. ┌───────────────┬──────────────────────────────────────────────────────────────┐
  4. critical Prototype Pollution in immer
  5. ├───────────────┼──────────────────────────────────────────────────────────────┤
  6. Package immer
  7. ├───────────────┼──────────────────────────────────────────────────────────────┤
  8. Patched in >=9.0.6
  9. ├───────────────┼──────────────────────────────────────────────────────────────┤
  10. Dependency of react-scripts
  11. ├───────────────┼──────────────────────────────────────────────────────────────┤
  12. Path react-scripts > react-dev-utils > immer
  13. ├───────────────┼──────────────────────────────────────────────────────────────┤
  14. More info https://www.npmjs.com/advisories/1002492 │
  15. └───────────────┴──────────────────────────────────────────────────────────────┘
  16. 115 vulnerabilities found - Packages audited: 1682
  17. Severity: 85 Moderate | 29 High | 1 Critical

react-dev-utils包的package.json文件使用了正确的immer版本。然而,由于react-script包的版本没有更改(在过去的8个月里仍然是4.0.3),因此更新没有发布到npm和yarn的包仓库中。

你是否尝试恢复依赖项?

是的,我尝试了

你在用户指南中搜索了哪些术语?

修复漏洞

环境

  1. Environment Info:
  2. current version of create-react-app: 4.0.3
  3. running from /Users/veselov/.npm/_npx/c67e74de0542c87c/node_modules/create-react-app
  4. System:
  5. OS: macOS 10.15.7
  6. CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  7. Binaries:
  8. Node: 14.15.4 - /usr/local/bin/node
  9. Yarn: 1.22.10 - ~/homebrew/bin/yarn
  10. npm: 7.22.0 - ~/homebrew/bin/npm
  11. Browsers:
  12. Chrome: 94.0.4606.71
  13. Edge: Not Found
  14. Firefox: 91.1.0
  15. Safari: 15.0
  16. npmPackages:
  17. react: ^17.0.2 => 17.0.2
  18. react-dom: ^17.0.2 => 17.0.2
  19. react-scripts: ^4.0.3 => 4.0.3
  20. npmGlobalPackages:
  21. create-react-app: Not Found

重现步骤

(在这里写下你的步骤:)

  1. 生成my-app
  1. npx create-react-app my-app
  2. cd my-app
  1. 运行审计
  1. yarn audit --level critical

预期行为

不期望有任何关键漏洞

实际行为

如上所述

可复现演示

使用当前版本的create-react-app
可能的安全事件
可能的合规风险

lqfhib0f

lqfhib0f1#

这是一个仅在开发环境中出现的问题,详见 #11174 以获取更多信息。

cuxqih21

cuxqih212#

在4.0.3中还有其他高危漏洞问题被标记。 => 运行npm audit
了解这可能只在开发中出现,但很高兴看到关注,因为很多时候开发代码都会发布以供测试。

7dl7o3gd

7dl7o3gd3#

这个开放项目有任何更新吗?问题仍然存在。

umuewwlo

umuewwlo4#

这个问题已经被自动标记为过时,因为它没有任何最近的活动。如果没有发生任何进一步的活动,它将在5天后被关闭。

velaa5lx

velaa5lx5#

是否可以将它移动到开发依赖项或升级到非易受攻击的版本?

kxe2p93d

kxe2p93d6#

当我使用yarn和npm运行时,我得到了高严重性的报告:

  1. $ yarn audit --level critical
  2. yarn audit v1.22.15
  3. info No lockfile found.
  4. warning @testing-library/jest-dom > css > source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
  5. warning react-scripts > @svgr/webpack > @svgr/plugin-svgo > svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
  6. warning react-scripts > @svgr/webpack > @svgr/plugin-svgo > svgo > stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
  7. warning react-scripts > css-minimizer-webpack-plugin > cssnano > cssnano-preset-default > postcss-svgo > svgo > stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
  8. 1 vulnerabilities found - Packages audited: 1230
  9. Severity: 1 High
  10. Done in 25.01s.
  11. $ npm audit
  12. # npm audit report
  13. nth-check <2.0.1
  14. Severity: high
  15. Inefficient Regular Expression Complexity in nth-check - https://github.com/advisories/GHSA-rp65-9cf3-cjxr
  16. fix available via `npm audit fix --force`
  17. Will install react-scripts@2.1.3, which is a breaking change
  18. node_modules/svgo/node_modules/nth-check
  19. css-select <=3.1.0
  20. Depends on vulnerable versions of nth-check
  21. node_modules/svgo/node_modules/css-select
  22. svgo 1.0.0 - 1.3.2
  23. Depends on vulnerable versions of css-select
  24. node_modules/svgo
  25. @svgr/plugin-svgo <=5.5.0
  26. Depends on vulnerable versions of svgo
  27. node_modules/@svgr/plugin-svgo
  28. @svgr/webpack 4.0.0 - 5.5.0
  29. Depends on vulnerable versions of @svgr/plugin-svgo
  30. node_modules/@svgr/webpack
  31. react-scripts >=2.1.4
  32. Depends on vulnerable versions of @svgr/webpack
  33. node_modules/react-scripts
  34. 6 high severity vulnerabilities
  35. To address all issues (including breaking changes), run:
  36. npm audit fix --force

环境:

  1. $ npx create-react-app --info
  2. Environment Info:
  3. current version of create-react-app: 5.0.1
  4. running from /.npm/_npx/c67e74de0542c87c/node_modules/create-react-app
  5. System:
  6. OS: Linux 5.15 Ubuntu 20.04.4 LTS (Focal Fossa)
  7. CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
  8. Binaries:
  9. Node: 16.15.1 - ~/.nvm/versions/node/v16.15.1/bin/node
  10. Yarn: 1.22.15 - ~/.nvm/versions/node/v16.15.1/bin/yarn
  11. npm: 8.11.0 - ~/.nvm/versions/node/v16.15.1/bin/npm
  12. Browsers:
  13. Chrome: 103.0.5060.114
  14. Firefox: 102.0
  15. npmPackages:
  16. react: ^18.2.0 => 18.2.0
  17. react-dom: ^18.2.0 => 18.2.0
  18. react-scripts: 5.0.1 => 5.0.1
  19. npmGlobalPackages:
  20. create-react-app: Not Found
展开查看全部
nue99wik

nue99wik7#

是否可以将它移动到开发依赖项或升级到非易受攻击的版本?
是的,你应该根据 #11174react-scripts 移动到开发依赖项。

相关问题