-
-
Notifications
You must be signed in to change notification settings - Fork 440
[Security] Update svgo dependency to fix nth-check vulnerability (CVE-2021-3803) in @svgr/plugin-svgoΒ #1014
Description
π Bug Report
The current version of @svgr/[email protected] depends on an outdated version of svgo@^1.2.2, which creates a dependency chain that includes the vulnerable [email protected] package. This vulnerability (CVE-2021-3803) has a CVSS score of 7.5 (High Severity) and affects all Create React App projects and any project using SVGR with SVGO optimization.
Vulnerability Details:
- CVE: CVE-2021-3803
- Type: Inefficient Regular Expression Complexity (ReDoS)
- CVSS Score: 7.5 (High Severity)
- Affected Package: [email protected] (transitive dependency)
- Fixed In: [email protected]+
To Reproduce
Steps to reproduce the behavior:
- Create a new Create React App project:
npx create-react-app test-svgr-vulnerability cd test-svgr-vulnerability- Run
npm ls nth-checkto see the vulnerable dependency - Run
npm auditto see the security vulnerability - Check BlackDuck, Snyk, or other security scanning tools - they will flag this vulnerability
Current Dependency Chain:
[email protected] βββ @svgr/[email protected] βββ @svgr/[email protected] βββ [email protected] (outdated - released 2019) βββ [email protected] βββ [email protected] (VULNERABLE β)
Expected behavior
The @svgr/plugin-svgo package should use a modern version of svgo (v2.x or v3.x) that depends on [email protected] or [email protected], which in turn depends on the fixed [email protected] versions.
Proposed Fix:
Update packages/plugin-svgo/package.json:
{
"dependencies": {
"svgo": "^2.0.0" // or "^3.0.0"
}
}Expected Fixed Chain:
@svgr/[email protected]
βββ [email protected] (or 3.x.x)
βββ [email protected] (or 5.x.x)
βββ [email protected]+ (SECURE β
)
Link to repl or repo (highly encouraged)
The issue can be reproduced in any project using Create React App or SVGR:
Minimal Reproduction:
npx create-react-app test-svgr-vulnerability
cd test-svgr-vulnerability
npm ls nth-check # Shows vulnerable [email protected]
npm audit # Shows CVE-2021-3803
Run npx envinfo --system --binaries --npmPackages @svgr/core,@svgr/cli,@svgr/webpack,@svgr/rollup --markdown --clipboard
## System:
- OS: macOS 14.x
- CPU: (8) arm64 Apple M1
- Memory: 16.00 GB / 16.00 GB
- Shell: /bin/zsh
## Binaries:
- Node: 18.17.0 - ~/.nvm/versions/node/v18.17.0/bin/node
- npm: 9.6.7 - ~/.nvm/versions/node/v18.17.0/bin/npm
## npmPackages:
- @svgr/webpack: ^5.5.0 (via [email protected])
- react-scripts: ^5.0.1