Skip to content

fix: strip credential env vars from child-process environment on Windows#9991

Open
mmaietta wants to merge 1 commit into
masterfrom
v27/t1-part2
Open

fix: strip credential env vars from child-process environment on Windows#9991
mmaietta wants to merge 1 commit into
masterfrom
v27/t1-part2

Conversation

@mmaietta

Copy link
Copy Markdown
Collaborator
  • getProcessEnv previously returned the Windows environment unchanged, so every spawned tool (signtool, makeappx, package managers) inherited credential vars such as CSC_KEY_PASSWORD, WIN_CSC_KEY_PASSWORD, and publish tokens. It now applies the same credential deny-list (stripSensitiveEnvVars) on Windows that the other platforms already use, for both the explicit-env and inherited-env paths. Required Windows system vars (PATH, SYSTEMROOT, TEMP, etc.) are preserved, and signing tools already receive the certificate password as an explicit CLI argument rather than via the environment, so signing is unaffected.

…nt on Windows (F1)

getProcessEnv previously returned the Windows environment unchanged, so every child process (signtool, makeappx, package managers) inherited credential vars such as CSC_KEY_PASSWORD, WIN_CSC_KEY_PASSWORD, and publish tokens. It now applies the same credential deny-list (stripSensitiveEnvVars) on Windows that the other platforms already use, for both the explicit-env and inherited-env cases.

Signing tools receive the certificate password as an explicit CLI argument, not via the environment, and the deny-list is verified not to drop required Windows system vars (PATH, SYSTEMROOT, TEMP, etc.), so signing and tool launches are unaffected.

Adds stripSensitiveEnvVars unit tests covering secret removal, system-var preservation, and prototype-pollution safety.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jun 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1ea11fd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
builder-util Patch
app-builder-lib Patch
dmg-builder Patch
electron-builder-squirrel-windows Patch
electron-builder Patch
electron-publish Patch
electron-forge-maker-appimage Patch
electron-forge-maker-nsis-web Patch
electron-forge-maker-nsis Patch
electron-forge-maker-snap Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

// (PATH, SYSTEMROOT, TEMP, etc.).
if (process.platform === "win32") {
return env == null ? undefined : env
return stripSensitiveEnvVars(env == null ? process.env : env)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: on non-Windows platforms, stripSensitiveEnvVars is not called when a explicit env is present, is the different behavior on Windows expected or is the non-Windows code just incorrect?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants