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

chores: npm extension: add shell option to execFile in windows env #212856

Closed
wants to merge 5 commits into from

Conversation

frankli0324
Copy link
Contributor

@frankli0324 frankli0324 commented May 16, 2024

resolves CVE-2024-27980

fixes: #211914

@Septh
Copy link

Septh commented May 17, 2024

I believe CVE-2024-27980 should be considered here:

    // corepack npm wrapper would automatically update package.json. disable that behavior.
    // COREPACK_ENABLE_AUTO_PIN disables the package.json overwrite, and
    // COREPACK_ENABLE_PROJECT_SPEC makes the npm view command succeed
    //   even if packageManager specified a package manager other than npm.
    const env = { ...process.env, COREPACK_ENABLE_AUTO_PIN: "0", COREPACK_ENABLE_PROJECT_SPEC: "0" }
    const shell = process.platform === 'win32'
    execFile(npmCommandPath, args, { cwd, env, shell }, (error, stdout) => {

@frankli0324
Copy link
Contributor Author

frankli0324 commented May 17, 2024

I believe CVE-2024-27980 should be considered here:

sry for not being familiar with windows but under what circumstances would npm be a cmd/bat script instead of an executable? okay it's distributed as a cmd script...

@frankli0324 frankli0324 changed the title fix: inherit process env when execFile npm view chores: npm extension: resolve CVE-2024-27980 by adding shell option to execFile May 24, 2024
@frankli0324 frankli0324 changed the title chores: npm extension: resolve CVE-2024-27980 by adding shell option to execFile chores: npm extension: add shell option to execFile in windows env May 24, 2024
@meganrogge meganrogge modified the milestones: June 2024, July 2024 Jun 19, 2024
@meganrogge meganrogge modified the milestones: July 2024, August 2024 Jul 23, 2024
@meganrogge
Copy link
Contributor

Closing as the linked bug has been fixed

@meganrogge meganrogge closed this Dec 18, 2024
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Feb 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spurious ${LOCALAPPDATA} folder created when hovering a dependency name in package.json
3 participants