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

302 moderate severity vulnerabilities in npm audit due to minimist package #8672

Closed
sphingu opened this issue Mar 18, 2020 · 19 comments
Closed

Comments

@sphingu
Copy link

sphingu commented Mar 18, 2020

Describe the bug

I have prepared new project with create-react-app. and then I have tried to run npm audit.
in that I got following output

Moderate        Prototype Pollution                                           
                                                                               
 Package         minimist                                                      
                                                                               
 Patched in      >=1.2.3                                                       
                                                                               
 Dependency of   react-scripts                                                 
                                                                               
 Path            react-scripts > webpack-dev-server > chokidar > fsevents >    
                 node-pre-gyp > rc > minimist                                  
                                                                               
 More info       https://npmjs.com/advisories/1179                             
                                                                               
found 302 moderate severity vulnerabilities in 918863 scanned packages
 302 vulnerabilities require manual review. See the full report for details.

Environment

package.json

"dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.3.2",
    "@testing-library/user-event": "^7.1.2",
    "react": "^16.13.0",
    "react-dom": "^16.13.0",
    "react-scripts": "3.4.0"
  },

System npm and node version:

npm -v
6.14.2
node -v
v12.12.0

Expected behavior

It should use suggested updated version of package minimist.

@mdodge-ecgrow
Copy link

Same issue here, except mine says 583 low severity vulnerabilities.

But I'm just curious about something from looking at the path. Does this mean the rc package dependency needs to be updated? Or the react-scripts dependency? Or something else entirely?

@briannakeune
Copy link

Stopped by to say I'm also having the same issue with 583 low severity vulnerabilities.

@kbarnesweb
Copy link

@briannakeune @mdodge-ecgrow If you have 583 then you likely need to update react-scripts to 3.4.0.

Change your package.json files to "react-scripts": "^3.4.0", and then run npm install

I still have the 302 low-security vulnerabilities though.

@embeddedt
Copy link

I think this is a webpack issue. I don't use react-scripts and I see similar warnings about minimist. I tried updating webpack to no avail.

@phoqe
Copy link

phoqe commented Mar 19, 2020

#8663

@mdodge-ecgrow
Copy link

@kbarnesweb My current package.json says "react-scripts": "3.4.0". Would the missing caret affect that?

@ddd-37
Copy link

ddd-37 commented Mar 19, 2020

After recommended fix - "Change your package.json files to "react-scripts": "^3.4.0", and then run npm install" - I still have 583 low severity vulnerabilities

@kbarnesweb
Copy link

@ddd-37 The carrot shouldn't be the reason it works or not in this case. I tried updating jest and it fixed 300 of the 302 issues. If you want to recreate this:

Run
npm i jest@latest
Then, delete package-lock.json and node_modules folder.

Reinstall
npm install

@kbarnesweb
Copy link

@ddd-37 I believe the final 2 issues are due to mkdirp still using an old version of minimist. I'll post here if I find a fix.

@KerimG
Copy link

KerimG commented Mar 19, 2020

Can confirm.

With react-scripts and node-sass, I got a total of 283 low severity vulnerabilities and it's all minimist, which seems to be a dependency of mkdirp in all cases. Mkdirp is using an old version of minimist.

"mkdirp": {
      "version": "0.5.1",
      "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
      "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
      "requires": {
        "minimist": "0.0.8"
      },

Seems like a fix is underway, though.

isaacs/node-mkdirp#7

@mdodge-ecgrow
Copy link

It appears like they've closed the issue. Does that mean it's done? The only resolution they gave at the end only applies to Yarn users and requires the user to manually do something. What about NPM users? And shouldn't this be a fix that is automatic and just happens when updating to the latest packages?

@jwandekoken
Copy link

Also having this issue. In my case, i just created a new project and i have 2 "Prototype Pollution" low severity vulnerabilities. They are both due the package "minimist", which are dependency of "react-scripts".
They both point to https://www.npmjs.com/advisories/1179 for more info

@dayvista
Copy link

I ran into the same issue, although I'm using my own React boilerplate w/ Babel and Webpack, not create-react-app. Turns out the chokidar package was using an older version of minimist (and was likely outdated itself). Running npm install chokidar updated chokidar to the latest version that uses a current version of minimist.

@rossjs
Copy link

rossjs commented Mar 31, 2020

This appears to be fixed in ^3.4.1

install react-scripts@latest to solve this

@sphingu sphingu closed this as completed Mar 31, 2020
@a-tonchev
Copy link

a-tonchev commented Apr 3, 2020

I still have it, even in 3.4.1, with yarn audit

@amit14apr
Copy link

Solution:
For npm users:

  1. npm install minimist --save-dev
    eg: (minimist version: 1.2.5)

  2. Add Resolution key adjacent to dependency key into package.json file
    {
    "resolutions": {
    "minimist": "^1.2.5"
    }
    }

  3. Add below line inside script key into package.json
    example:
    "scripts": {
    "preinstall": "npx npm-force-resolutions"
    }

  4. Remove node_modules, and then run command: npm install.

That's it. :)

@emilyfoxmusic
Copy link

I am also still getting this issue after upgrading to react-scripts 3.4.1. I've temporarily used @amit14apr's solution above, but it would be nice if it could be fixed at source.

Has this issue been incorrectly closed, or are we missing some required step to make it work?

@a-tonchev
Copy link

I still have it, even in 3.4.1, with yarn audit

After reinstalling node modules and yarn lock, everything works fine now. Thanks ;)

@alioguzhan
Copy link

alioguzhan commented Apr 10, 2020

  • Upgrade react-scripts to 3.4.1 in package.json
  • Remove yarn.lock file
  • Perform a clean install with yarn install

To see if it is fixed, run npm ls minimist. It should be something like this:

image

@lock lock bot locked and limited conversation to collaborators Apr 15, 2020
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