Skip to content

Fix: Windows uninstaller re-adds package bin path to PATH#6458

Open
jedisct1 wants to merge 1 commit intowasmerio:mainfrom
dip-proto:windows-uninstall-readds-package-bin-to-path
Open

Fix: Windows uninstaller re-adds package bin path to PATH#6458
jedisct1 wants to merge 1 commit intowasmerio:mainfrom
dip-proto:windows-uninstall-readds-package-bin-to-path

Conversation

@jedisct1
Copy link
Copy Markdown

SUMMARY
The Windows uninstall hook removes {app}\bin from PATH but mistakenly calls EnvAddPath for {app}\globals\wapm_packages\.bin, leaving that stale path behind after uninstall.

PROVENANCE
This exploration and report were automatically generated by the Swival Security Scanner (https://swival.dev).

PRECONDITIONS

  • The Windows installer is used to install Wasmer.
  • The product is later uninstalled, triggering CurUninstallStepChanged.

PROOF

  1. Input/source/state origin: installation adds both {app}\bin and {app}\globals\wapm_packages\.bin to PATH in scripts/windows-installer/wasmer.iss:79-85.
  2. Control-flow and data-flow path: uninstall runs CurUninstallStepChanged in scripts/windows-installer/wasmer.iss:88-95.
  3. Failing condition or violated invariant: the uninstall hook removes {app}\bin with EnvRemovePath(...) at line 92, but line 93 calls EnvAddPath(...) for {app}\globals\wapm_packages\.bin instead of removing it.
  4. Resulting impact: uninstall leaves a dead Wasmer path in the user PATH variable, so command resolution and environment state remain incorrect after removal.
  5. Why this is reachable in the current code: CurUninstallStepChanged is the tracked uninstall handler, and the wrong function call is unconditional inside its usPostUninstall branch.

WHY THIS IS A REAL BUG
This is a real lifecycle bug in shipped installer logic: uninstall mutates PATH in the wrong direction, leaving stale machine state behind.

PATCH RATIONALE
The patch changes the single incorrect EnvAddPath call to EnvRemovePath. It is the smallest fix and only affects uninstall cleanup.

RESIDUAL RISK
None

Description

SUMMARY
The Windows uninstall hook removes `{app}\bin` from PATH but mistakenly calls `EnvAddPath` for `{app}\globals\wapm_packages\.bin`, leaving that stale path behind after uninstall.

PROVENANCE
This exploration and report were automatically generated by the Swival Security Scanner (https://swival.dev).

PRECONDITIONS
- The Windows installer is used to install Wasmer.
- The product is later uninstalled, triggering `CurUninstallStepChanged`.

PROOF
1. Input/source/state origin: installation adds both `{app}\bin` and `{app}\globals\wapm_packages\.bin` to PATH in `scripts/windows-installer/wasmer.iss:79-85`.
2. Control-flow and data-flow path: uninstall runs `CurUninstallStepChanged` in `scripts/windows-installer/wasmer.iss:88-95`.
3. Failing condition or violated invariant: the uninstall hook removes `{app}\bin` with `EnvRemovePath(...)` at line 92, but line 93 calls `EnvAddPath(...)` for `{app}\globals\wapm_packages\.bin` instead of removing it.
4. Resulting impact: uninstall leaves a dead Wasmer path in the user PATH variable, so command resolution and environment state remain incorrect after removal.
5. Why this is reachable in the current code: `CurUninstallStepChanged` is the tracked uninstall handler, and the wrong function call is unconditional inside its `usPostUninstall` branch.

WHY THIS IS A REAL BUG
This is a real lifecycle bug in shipped installer logic: uninstall mutates PATH in the wrong direction, leaving stale machine state behind.

PATCH RATIONALE
The patch changes the single incorrect `EnvAddPath` call to `EnvRemovePath`. It is the smallest fix and only affects uninstall cleanup.

RESIDUAL RISK
None
Copilot AI review requested due to automatic review settings April 12, 2026 17:30
@jedisct1 jedisct1 requested a review from syrusakbary as a code owner April 12, 2026 17:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a Windows uninstaller lifecycle bug where the uninstall hook removed {app}\bin from PATH but mistakenly re-added {app}\globals\wapm_packages\.bin, leaving a stale entry after uninstall.

Changes:

  • Replace an incorrect EnvAddPath call with EnvRemovePath in the uninstall step handler to properly clean up PATH.

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.

2 participants