-
Notifications
You must be signed in to change notification settings - Fork 642
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
Remove mkdirp@^0.5.1
due to CVE warnings, use native recursive fs.mkdir
#768
Conversation
Hi @ericanderson! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
fefe534
to
a7556f3
Compare
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @ericanderson for working on this! in the diff summary, can you give some examples of the security warnings and why this version bump and implementation change fixes them? thanks!
@philIip Github security warnings. The ones where you are the owner of a project and you visit the project's home page and get a giant warning from GitHub telling you there are CVE's in libraries within your repo. I don't know for sure if metro was or was not vulnerable. I'm sure this wouldn't affect someone's production code. What I do know is that humans build tolerance and blindness to things over time. Having a security warning linger on a repo/project is a long term risk to other, real security vulnerabilities being seen and fixed. This version bump fixes the issue because it is the recommended version to resolve the CVE. The code delta is to deal with the vulnerable library having a major semver change and thus the code needed to be adapted. |
@philIip has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
As an aside which shouldn't block this change, it seems like maintaining The memfs library seems complete and well maintained. It is what webpack switched to after abandoning its own memory-fs (top right corner see deprecation notice). |
@rh389 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Hi @ericanderson - thanks for working on this. Unfortunately, it's proving problematic to merge internally due to the way we manage direct dependencies across the containing workspace (upshot being we'd have to update To be honest, I'm thinking it'd be simpler to eliminate |
@rh389 fair enough, will pivot as I'd prefer to get these warnings out of my repos. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could just tidy up the async call with the fs promises API, otherwise perfect (and thanks again)
Edit: Ah, also looks like we'll need to beef up the implementation of recursive
in metro-memory-fs
a bit
const mkdirPromised = util.promisify(fs.mkdir); | ||
return mkdirPromised(dirName, {recursive: true}).then(() => undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const mkdirPromised = util.promisify(fs.mkdir); | |
return mkdirPromised(dirName, {recursive: true}).then(() => undefined); | |
return fsPromises.mkdir(dirName, {recursive: true}); |
@@ -86,9 +87,8 @@ function saveAsAssets( | |||
} | |||
|
|||
function createDir(dirName: string): Promise<empty> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function createDir(dirName: string): Promise<empty> { | |
function createDir(dirName: string): Promise<void> { |
const fs = require('fs'); | ||
const util = require('util'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const fs = require('fs'); | |
const util = require('util'); | |
const fsPromises = require('fs').promises; |
339a754
to
4bfd7b4
Compare
@rh389 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
mkdirp@^0.5.1
(due to CVE warnings) in favour of native recursive fs.mkdir
@rh389 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
mkdirp@^0.5.1
(due to CVE warnings) in favour of native recursive fs.mkdirmkdirp@^0.5.1
due to CVE warnings, use native recursive fs.mkdir
Thanks for the help getting it through @rh389. Sorry about the false start earlier. I was in and out of meetings and pushed before running tests. |
Not at all - I was just keen to get it pulled in before the end of my day yesterday. It's waiting for internal review now but everything's green so I'd expect it to be in the next fortnightly release, this PR will auto-close when it lands. Thanks again for the contribution (and patience!) |
…mkdir` (facebook#768) Summary: **Summary** mkdirp was triggering github security warnings. **Details** Github security warnings. The ones where you are the owner of a project and you visit the project's home page and get a giant warning from GitHub telling you there are CVE's in libraries within your repo. I don't know for sure if metro was or was not vunerable. I for sure know this wouldn't affect someone's production code. What I do know is that humans build tolerance and blindness to things over time. Having a security warning linger on a repo/project is a long term risk to other, real security vulnerabilities being seen and fixed. **Test plan** `yarn test` Pull Request resolved: facebook#768 Reviewed By: GijsWeterings Differential Revision: D33986388 Pulled By: rh389 fbshipit-source-id: c1d3ebc3b4ed0c9bd8d3348cfc052ccd6a5cc4a5
…mkdir` (facebook#768) Summary: **Summary** mkdirp was triggering github security warnings. **Details** Github security warnings. The ones where you are the owner of a project and you visit the project's home page and get a giant warning from GitHub telling you there are CVE's in libraries within your repo. I don't know for sure if metro was or was not vunerable. I for sure know this wouldn't affect someone's production code. What I do know is that humans build tolerance and blindness to things over time. Having a security warning linger on a repo/project is a long term risk to other, real security vulnerabilities being seen and fixed. **Test plan** `yarn test` Pull Request resolved: facebook#768 Reviewed By: GijsWeterings Differential Revision: D33986388 Pulled By: rh389 fbshipit-source-id: c1d3ebc3b4ed0c9bd8d3348cfc052ccd6a5cc4a5
…mkdir` (facebook#768) Summary: **Summary** mkdirp was triggering github security warnings. **Details** Github security warnings. The ones where you are the owner of a project and you visit the project's home page and get a giant warning from GitHub telling you there are CVE's in libraries within your repo. I don't know for sure if metro was or was not vunerable. I for sure know this wouldn't affect someone's production code. What I do know is that humans build tolerance and blindness to things over time. Having a security warning linger on a repo/project is a long term risk to other, real security vulnerabilities being seen and fixed. **Test plan** `yarn test` Pull Request resolved: facebook#768 Reviewed By: GijsWeterings Differential Revision: D33986388 Pulled By: rh389 fbshipit-source-id: c1d3ebc3b4ed0c9bd8d3348cfc052ccd6a5cc4a5
Summary
mkdirp was triggering github security warnings. Upgrading version will resolve that.
Details
Github security warnings. The ones where you are the owner of a project and you visit the project's home page and get a giant warning from GitHub telling you there are CVE's in libraries within your repo.
I don't know for sure if metro was or was not vulnerable. I for sure know this wouldn't affect someone's production code. What I do know is that humans build tolerance and blindness to things over time. Having a security warning linger on a repo/project is a long term risk to other, real security vulnerabilities being seen and fixed.
This version bump fixes the issue because it is the recommended version to resolve the CVE.
The code delta is to deal with the vulnerable library having a major semver change and thus the code needed to be adapted.
Test plan
yarn test