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

Task: Upgrade cross-spawn version due to Node Cross-Spawn Vulnerability (CVE-2024–21538) #1038

Open
3 tasks
vinhyan opened this issue Dec 5, 2024 · 9 comments
Assignees

Comments

@vinhyan
Copy link
Contributor

vinhyan commented Dec 5, 2024

Describe the task

Looks like the issue of cross-spawn might be from this transitive dependency, upgrading the parent dependency is needed:
image

High vulnerability issue with the current cross-spawn version 7.0.3. CVE-2024-21538

npm audit fix cannot fix unless bumping up version to 7.0.5 or above.

Acceptance Criteria

  • cross-spawn dependency is updated to version 7.0.5 or higher in the npm package.
  • The vulnerability CVE-2024-21538 in cross-spawn is no longer flagged by npm audit.
  • The fix does not break any existing functionality or dependencies in the project.

Additional context

  • This issue is affecting code commits due to a failure in npm audit.
    CVE-2024-21538
@vinhyan vinhyan changed the title Task: Update cross-pawn version due to Node Cross-Spawn Vulnerability (CVE-2024–21538) Task: Upgrade cross-pawn version due to Node Cross-Spawn Vulnerability (CVE-2024–21538) Dec 5, 2024
@vinhyan vinhyan changed the title Task: Upgrade cross-pawn version due to Node Cross-Spawn Vulnerability (CVE-2024–21538) Task: Upgrade cross-spawn version due to Node Cross-Spawn Vulnerability (CVE-2024–21538) Dec 5, 2024
@vinhyan
Copy link
Contributor Author

vinhyan commented Dec 6, 2024

Our locked npm version is 10.8.3, which uses cross-spawn v7.0.3—a version with the above vuln. I tested modifying the npm version to 10.9.1 directly in the lockfile, deleted node_modules, and ran npm i. This approach worked, as npm 10.9.1 uses cross-spawn 7.0.6, which does not have the vuln issue. However, I’m not sure if manually editing the lockfile is recommended.

This issue is currently blocking me from committing code, so any advice on resolving it would be greatly appreciated. :) @CodeWritingCow

@vinhyan
Copy link
Contributor Author

vinhyan commented Dec 7, 2024

@nlebovits also looping you in for advice on this. Thanks! :)

@nlebovits
Copy link
Collaborator

Hey @vinhyan sorry for my slow response on this! Was OOO while traveling. I'm not a JS expert at all but I'll make sure @CodeWritingCow sees this and gets back to you.

@CodeWritingCow
Copy link
Collaborator

@vinhyan When I ran npm update and then npm audit locally, the vulnerability alert for cross-spawn disappeared.

Also ran npm ls cross-spawn to verify that cross-spawn got upgraded to v7.0.6:
Screen Shot 2024-12-15 at 3 25 49 PM

Generally, I recommend not manually changing package-lock.json. We should update and manage it using npm commands such as npm install and npm update. That file tracks both our application's top dependencies and their nested dependencies.

@millmason
Copy link
Contributor

millmason commented Jan 13, 2025

@CodeWritingCow I've been having the same problem. I was able to temporarily resolve it using the steps you described (running npm update and npm audit from a fresh install), but I kept hitting an error. When the frontend compiles on my machine, I consistently get:

⨯ ./node_modules/react-map-gl/dist/esm/exports-mapbox.js:16:1
Module not found: Can't resolve 'mapbox-gl'

It seems like it's due to a version discrepancy with the dependency gl-matrix, so I installed that separately and the Module not found error went away...but the cross-spawn issue came back. Do you know if this a known issue, or something that I might be specific to me? I thought about opening a new issue but figured it might be better to check here first, since they seem related

@millmason
Copy link
Contributor

I'm still getting this error (and blocked from committing as a result) in spite of pulling down a clean download and following the given steps (npm i, npm update, npm audit. Strangely, when I run npm ls cross-spawn, it shows that I've successfully updated it to 7.0.6, but the error still comes up in the pre-commit hook. Is there a step I'm omitting?

@CodeWritingCow
Copy link
Collaborator

CodeWritingCow commented Jan 15, 2025

@millmason can you see if you can commit your code by using the --no-verify flag?

Something like git commit -m "Your commit message here" --no-verify? It'd bypass the pre-commit hook. Not ideal but it could be a temporary workaround until I can figure out what's going on with this error.

@millmason
Copy link
Contributor

@CodeWritingCow that works perfect! Thank you!

@CodeWritingCow CodeWritingCow self-assigned this Jan 15, 2025
@CodeWritingCow
Copy link
Collaborator

@millmason you are welcome! Thanks for following up on this. It fell off my radar because I was working on fixing a separate issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

4 participants