Repository navigation
fix: restrict asar esm hook resolution to app resources - #324851
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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.
Robo (deepak1556)
force-pushed
the
robo/fix_asar_default_resolution
branch
from
July 8, 2026 00:19
36a7a23 to
9e085b3
Compare
Robo (deepak1556)
marked this pull request as ready for review
July 8, 2026 00:20
Robo (deepak1556)
enabled auto-merge (squash)
July 8, 2026 00:26
Ben Villalobos (benvillalobos)
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For https://github.com/microsoft/vscode/actions/runs/28892004045/job/85706834505