NPM audit reports the package with high vulnerability (Denial of Service)
More info https://www.npmjs.com/advisories/1486
And there goes CI pipelines across the globe...
Seems like a key bit here that limits the scope:
This is only possible when the proxy server sets headers in the proxy request using the proxyReq.setHeader function.
Wouldn't this be a short term work around - proxyReq.headers['arr'] = "I'm a pirate" ?
I get the security warning from NPM about this package too. Using react-scripts (https://github.com/facebook/create-react-app)
Yeah, projects using webpack-dev-server will have this warning.
Is there a fix for this in the works?
Our pipeline returns this audit failure High Denial of Service Package http-proxy Patched in No patch available Dependency of react-scripts Path react-scripts > webpack-dev-server > http-proxy-middleware > http-proxy More info https://nodesecurity.io/advisories/1486
npm audit warns in projects with webpack-dev-server
webpack-dev-server > http-proxy-middleware > http-proxy
sam withyarn audit
So you can provisionally fix this by moving webpack-dev-server or react-scripts (whichever package is causing the issue) to devDependencies.
Once the package is in your devDependencies you can run npm audit --prod and it will not audit the package as it only audits the node packages in your dependencies with the --prod arg passed to the CLI.
npm auditwarns in projects withwebpack-dev-serverwebpack-dev-server > http-proxy-middleware > http-proxy
Same for react-scripts as it depends on webpack-dev-server
react-scripts > webpack-dev-server > http-proxy-middleware > http-proxy
audit-ci npm dependency can also be used instead of npm audit to whitelist this particular dependency.
audit-ci npm dependency can also be used instead of npm audit to whitelist this particular dependency.
Yes, if you use https://github.com/IBM/audit-ci, you can whitelist http-proxy like that:
$ npx audit-ci --high --whitelist=http-proxy
Caution
It's not recommended to use packages with vulnerabilities. In my case I've had to whitelist this in order for Travis CI to continue working.
audit-ci npm dependency can also be used instead of npm audit to whitelist this particular dependency.
Yes, if you use https://github.com/IBM/audit-ci, you can whitelist
http-proxylike that:$ npx audit-ci --high --whitelist=http-proxy
Sorry for noob question, but does this mean it isn't risky to use locally?
audit-ci npm dependency can also be used instead of npm audit to whitelist this particular dependency.
Yes, if you use https://github.com/IBM/audit-ci, you can whitelist
http-proxylike that:$ npx audit-ci --high --whitelist=http-proxySorry for noob question, but does this mean it isn't risky to use locally?
In theory it still is but by whitelisting you're intentionally ignoring the vulnerability. However i think this particulair vulnerability is more of a threat when published on a server.
@Jackques, I tried running the whitelist command and it had no luck for me. Would it work if you were to CRA and then run --> npm uninstall http-proxy ?
@Jackques, I tried running the whitelist command and it had no luck for me. Would it work if you were to CRA and then run --> npm uninstall http-proxy ?
If you use https://github.com/IBM/audit-ci then you should be able to set the error id (which relates to the security vul. issue id) in a .json. Check the audit-cli package for details. No need to reinstall the package in order to whitelist it. Once you have got the security id in your witelist the package should no longer appear in the security report.
@Jackques, Thank you! What I meant to say was that what if you dont whitelist it? In my specfic situation: I am working in a group repo with branches and I am tying to install the dependencies for the client from create-react-app (where as I go to the master branch, git pull'd --> ran npm i | npm install). At that point i was saying what if you uninstall http-proxy at ^that point(after installing dependencies ad seeing the warning) instead of whitelisting? If that's a clearer way to ask the question?
Else: Again I thank you for your help!
I'm actually more concerned as to what specifically is wrong within the http-proxy package that is causing the error in the first place.
Disappointed that people are recommending whitelisting http-proxy or worse still completely disabling audit of devDependencies in response to this. I would guess that 90% of the people that read this thread and take that advice probably don't understand the full implications of it and will not reinstate the audit after http-proxy is fixed.
It's not just vulnerabilities that audit guards against but intentional exploits also. Just think about what things the code in those devDependencies has access to when it runs on your local machine or build agent:
- Probably some private keys, database passwords, etc.
- If you're in the cloud your build agent may well have privileged access to your cloud resources so it can deploy/modify things.
- That code may not be directly included in your production JS files but it's able to access and manipulate those files so it could rewrite them any way it wanted.
- It could duplicate itself to any npm packages you publish from your build agent
In summary: please don't do that.
According to the advisory, this was reported back in February. Count me disappointed as well.