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

Open
wants to merge 5 commits into
base: main
Choose a base branch
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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