Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulnerability in react-scripts > @svgr/webpack > @svgr/plugin-svgo > svgo > css-select > nth-check & css-what #12132

Closed
im-deepakk opened this issue Mar 4, 2022 · 25 comments

Comments

@im-deepakk
Copy link

Describe the bug

Upgrade react-scripts to have the @@svgr/webpack@6.* as the dependency. As the current @svgr/[email protected] has following vulnerable versions as dependency.

nth-check - https://security.snyk.io/vuln/SNYK-JS-NTHCHECK-1586032
css-what - https://security.snyk.io/vuln/SNYK-JS-CSSWHAT-1298035

Below is the dependency tree:

+-- [email protected]
├─┬ @svgr/[email protected]
│ └─┬ @svgr/[email protected]
│ └─┬ [email protected]
│ └─┬ [email protected]
│ └── [email protected]
└──[email protected]

Environment

Environment Info:
current version of create-react-app: 5.0.0
System:
OS: Windows 7 6.1.7601
CPU: (8) x64 Intel(R) Xeon(R) CPU E3-1585L v5 @ 3.00GHz
Binaries:
Node: 14.17.6 - ...\tools\nodejs14-win7\latest\node.EXE
Yarn: Not Found
npm: 8.2.0 - ...\data\npm14\npm.CMD
Browsers:
Chrome: 97.0.4692.71
Internet Explorer: 11.0.9600.20139

Steps to reproduce

npx create-react-app

Expected behavior

The react-scripts should not be having any dependency on vulnerable components.

Actual behavior

The dependent package @svgr/webpack 5.5.0 refers to vulnerable components, as per the author the v6 has the fix for the same.

@Vishal-Mayal
Copy link

Hi, any updates on when the package will be updated?
Thank you.

@PraveenkumarD2004
Copy link

Hi, I am also facing the same issue. When I upgrading react-scripts to 5.0.0 version. While npm audit I am getting the same Vulnerability Error.

Error:
Will install [email protected], 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

FYI, Upgrade react-scripts to have the @@svgr/webpack@6. as the dependency. As the current @svgr/[email protected] has following vulnerable versions as dependency.

Thanks & Regards,
Praveen Kumar D.

@palminha
Copy link

palminha commented Mar 8, 2022

same here...

% npm audit
# npm audit report

nth-check  <2.0.1
Severity: moderate
Inefficient Regular Expression Complexity in nth-check - https://github.com/advisories/GHSA-rp65-9cf3-cjxr
fix available via `npm audit fix --force`
Will install [email protected], 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 moderate severity vulnerabilities

I'm using react-scripts 5.0.0

% npm list react-scripts
[email protected] /Users/palmito/Development/risk-util-tool/webapp
└── [email protected]

@palminha
Copy link

palminha commented Mar 8, 2022

the vulnerable dependency is dependent of [email protected]

% npm list nth-check
create-react-app@ /Users/palmito/Development/create-react-app
├─┬ cra-docs@ -> ./docusaurus/website
│ └─┬ @docusaurus/[email protected]
│   └─┬ @slorber/[email protected]
│     └─┬ [email protected]
│       └─┬ [email protected]
│         └── [email protected]
├─┬ [email protected] -> ./packages/react-scripts
│ └─┬ [email protected]
│   └─┬ [email protected]
│     └─┬ [email protected]
│       └─┬ [email protected]
│         └── [email protected]
└─┬ [email protected]
  └─┬ [email protected]
    └─┬ [email protected]
      └── [email protected]

@palminha
Copy link

palminha commented Mar 8, 2022

The vulnerable dependency is caused by svg-term-cli
project seems to be abandoned for a couple of years (a lot of dependabot pull-requests getting rotten...)

@palminha
Copy link

palminha commented Mar 8, 2022

@marionebl any feedback on svg-term-cli ?

@slowWriting
Copy link

Have you guys read this stickied issue?
#11174

@palminha
Copy link

palminha commented Mar 8, 2022

moving the dependency to dev makes the vulnerability only dependent of svgr/webpack

% npm list nth-check
[email protected] /Users/palmito/Development/risk-util-tool/webapp
└─┬ [email protected]
  ├─┬ @svgr/[email protected]
  │ └─┬ @svgr/[email protected]
  │   └─┬ [email protected]
  │     └─┬ [email protected]
  │       └── [email protected]
  └─┬ [email protected]
    └─┬ [email protected]
      └─┬ [email protected]
        └─┬ [email protected]
          └── [email protected]

followed-up here #12146

@PraveenkumarD2004
Copy link

Hi, any updates on when the package will be updated?
Thanks & Regards,
Praveen Kumar D.

@Stunext
Copy link

Stunext commented Mar 15, 2022

Read this: #11174 ...then wait, there are more important things than fixing false positives. It will be fixed at the next scheduled update or when a critical bug appears.

@Githubbubber
Copy link

Read this: #11174 ...then wait, there are more important things than fixing false positives. It will be fixed at the next scheduled update or when a critical bug appears.

Fair enough

@JY1148
Copy link

JY1148 commented Apr 1, 2022

same issue.

npm run build, failed to compile.
npm audit fix, got this:

Snipaste_2022-03-31_23-09-38

@vishal-bypt
Copy link

vishal-bypt commented Apr 27, 2022

Is there any ETA for nth-check & css-what vulnerabilities?

Julien-JME added a commit to Delmonicos/user-frontend that referenced this issue May 4, 2022
Move react-scripts into dev-dependencies. see facebook/create-react-app#12132.
@thomazcapra
Copy link

thomazcapra commented May 18, 2022

While this issue is not fixed, I did a workaround to solve it.

The problem seems to be starting with the lib @svgr/webpack 4.0.0 - 5.0.0.

image

If you are using node >= 16, you can install @svgr/webpack by yourself, in my case I installed the version: "^6.2.1" as devDependency.

image

After that, you should create a overrides (or resolutions if you are using yarn) section in your package.json and include the line: @svgr/webpack": "$@svgr/webpack. (in my case, I already had the react and react-dom).

image

And last, you must remove your node_modules folder and your package-lock.json, and execute npm install.

This worked for me :)

image

@irangar
Copy link

irangar commented May 31, 2022

And last, you must remove your node_modules folder and your package-lock.json, and execute npm install.

thanks, bro

@miotegui
Copy link

miotegui commented May 31, 2022

And last, you must remove your node_modules folder and your package-lock.json, and execute npm install.

i was getting mad, thanks bro! it worked perfect.

if there's a newbie like me there, you can install the dependency with this line:

npm install @svgr/webpack --save-dev

urfolomeus added a commit to tablexi/a11y-testing-sandbox that referenced this issue Jun 2, 2022
@GlennVialli
Copy link

While this issue is not fixed, I did a workaround to solve it.

The problem seems to be starting with the lib @svgr/webpack 4.0.0 - 5.0.0.

image

If you are using node >= 16, you can install @svgr/webpack by yourself, in my case I installed the version: "^6.2.1" as devDependency.

image

After that, you should create a overrides (or resolutions if you are using yarn) section in your package.json and include the line: @svgr/webpack": "$@svgr/webpack. (in my case, I already had the react and react-dom).

image

And last, you must remove your node_modules folder and your package-lock.json, and execute npm install.

This worked for me :)

image

In my case,
my overrides in package.json should be

"overrides": {
"@svgr/webpack": "^6.2.1"
},

@thomazcapra
Copy link

In my case, my overrides in package.json should be

"overrides": { "@svgr/webpack": "^6.2.1" },

"To make this limitation easier to deal with, overrides may also be defined as a reference to a spec for a direct dependency by prefixing the name of the package you wish the version to match with a $"

https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides

image

@FernandoPerezLara
Copy link

FernandoPerezLara commented Jun 8, 2022

Best solution:

"overrides": {
  "nth-check": "2.0.1"
},

@orsharab-yy
Copy link

Is there any ETA for this?

@struginskij
Copy link

Any update?

@chandrajitsatapathy
Copy link

And last, you must remove your node_modules folder and your package-lock.json, and execute npm install.

i was getting mad, thanks bro! it worked perfect.

if there's a newbie like me there, you can install the dependency with this line:

npm install @svgr/webpack --save-dev

npm install --save-dev webpack@ edit the version to the required one.

@taimoorimran
Copy link

Any update?

Pochetes added a commit to Facebook-University-Projects/Swimster that referenced this issue Jul 19, 2022
Pochetes added a commit to Facebook-University-Projects/Swimster that referenced this issue Jul 23, 2022
@callain
Copy link

callain commented Jul 26, 2022

If you move react-scripts in "devDependencies", npm audit --production do not display any vulnerabilities.

The best explanation of why everything is in "dependencies" is here.
https://stackoverflow.com/questions/44868453/create-react-app-install-devdepencies-in-dependencies-section/44872787#44872787

But in fact, it matters when running npm audit --production because devDependencies are ignored.

toikarin-vincit added a commit to City-of-Helsinki/hitas that referenced this issue Aug 30, 2022
 - should get a rid of a high severity security issue with a
   dev dependency. nth-check is vulnerable to Inefficient Regular
   Expression Complexity.
 - see facebook/create-react-app#12132
   for more info
toikarin-vincit added a commit to City-of-Helsinki/hitas that referenced this issue Aug 30, 2022
 - should get a rid of a high severity security issue with a
   dev dependency. nth-check is vulnerable to Inefficient Regular
   Expression Complexity.
 - see facebook/create-react-app#12132
   for more info
toikarin-vincit added a commit to City-of-Helsinki/hitas that referenced this issue Aug 30, 2022
 - should get a rid of a high severity security issue with a
   dev dependency. nth-check is vulnerable to Inefficient Regular
   Expression Complexity.
 - see facebook/create-react-app#12132
   for more info
ryancwalsh added a commit to NEARFoundation/trulioo-app that referenced this issue Aug 31, 2022
…reate-react-app#12132 (comment) but still seeing `warning Resolution field "$@svgr/webpack" has an invalid version entry and may be ignored` during `yarn install`
ryancwalsh added a commit to NEARFoundation/trulioo-app that referenced this issue Aug 31, 2022
…cebook/create-react-app#12132 (comment) but still seeing `warning Resolution field "$@svgr/webpack" has an invalid version entry and may be ignored` during `yarn install`"

This reverts commit 9ab4261.
@gaearon
Copy link
Contributor

gaearon commented Sep 12, 2022

#11647 (comment)

@gaearon gaearon closed this as completed Sep 12, 2022
@facebook facebook locked as resolved and limited conversation to collaborators Sep 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests