Skip to content

fix: restrict asar esm hook resolution to app resources - #324851

Merged
Robo (deepak1556) merged 1 commit into
mainfrom
robo/fix_asar_default_resolution
Jul 8, 2026
Merged

Robo (deepak1556) merged 1 commit into
mainfrom
robo/fix_asar_default_resolution

Conversation

@deepak1556

Copy link
Copy Markdown
Collaborator

@deepak1556 Robo (deepak1556) added this to the 1.129.0 milestone Jul 8, 2026
@deepak1556 Robo (deepak1556) self-assigned this Jul 8, 2026
Copilot AI review requested due to automatic review settings July 8, 2026 00:07

Copilot AI left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens VS Code's ASAR-aware ESM module resolution hook in src/bootstrap-esm.ts. The hook currently accepts the first successful default (nextResolve) resolution unconditionally, only consulting the node_modules.asar archive when the default walk throws. The problem is that when the packaged app is nested inside a larger tree (e.g. @vscode/test-electron downloading the packaged app under the repo's own node_modules), the default node_modules walk can escape resources/app and pick up a stale / ABI-mismatched copy. This change restricts the default resolution so it only "wins" when it lands inside the application tree (resources/app); otherwise the archive takes precedence.

Changes:

  • Refactored the resolve hook to capture the default resolution result/error up front instead of returning immediately on success.
  • Added a guard that only accepts a default resolution whose resolved path starts with resourcesPath (or is a non-file URL), otherwise falling through to archive-based resolution.

@deepak1556
Robo (deepak1556) force-pushed the robo/fix_asar_default_resolution branch from 36a7a23 to 9e085b3 Compare July 8, 2026 00:19
@deepak1556
Robo (deepak1556) marked this pull request as ready for review July 8, 2026 00:20
@deepak1556
Robo (deepak1556) enabled auto-merge (squash) July 8, 2026 00:26
@deepak1556
Robo (deepak1556) merged commit 89bc382 into main Jul 8, 2026
29 checks passed
@deepak1556
Robo (deepak1556) deleted the robo/fix_asar_default_resolution branch July 8, 2026 00:36
Robo (deepak1556) added a commit that referenced this pull request Jul 8, 2026
* Revert "fix: builtin resolution of electron modules via asar hook (#324861)"

This reverts commit 5928613.

* Revert "fix: restrict asar esm hook resolution to app resources (#324851)"

This reverts commit 89bc382.

* Revert "feat: restore asar for node_modules (#324084)"

This reverts commit c9dda3b.
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Aug 22, 2026
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.

3 participants