fix: extension bootstrap path mismatch in launchExtension() (#2890)#2957
Open
polajenko wants to merge 1 commit intogithub:mainfrom
Open
fix: extension bootstrap path mismatch in launchExtension() (#2890)#2957polajenko wants to merge 1 commit intogithub:mainfrom
polajenko wants to merge 1 commit intogithub:mainfrom
Conversation
Extensions fail to load on macOS and Windows because the forked child process's security check in index.js expects the bootstrap path under dirname(process.execPath), but app.js passes a path from the pkg cache (universal/<ver>/preloads/). This document describes the root cause analysis and two proposed fixes: - Option A: resolve bootstrap path from SEA binary dir + ship preloads in platform packages - Option B: expand the security check to trust the pkg cache directory Fixes github#2890 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Extensions fail to load on both macOS and Windows because the forked child process's security check in
index.jsexpects the bootstrap path underdirname(process.execPath)(the SEA binary directory), butapp.jspasses a path from the pkg cache (universal/<ver>/preloads/).This affects all extensions — both user-level and project-level — on CLI v1.0.34 and v1.0.35.
Fixes #2890
Root Cause
index.js)darwin-arm64/<ver>/npm/.../copilot-win32-x64/app.js)universal/<ver>/preloads/universal/<ver>/preloads/preloads/exists in SEA dir?The security check in the embedded
index.js:Proposed Fixes
Option A (smallest change): In
launchExtension(), resolve bootstrap path fromdirname(process.execPath)instead ofcliDistDir, and shippreloads/in platform npm packages.Option B (no package changes): Expand the
index.jssecurity check to also trust thecliDistDirpkg cache path (passed via env var from parent).See
fix-extension-bootstrap-path.mdin this PR for full details and code samples.Verification
Option A tested locally on Windows 11 (npm install, CLI 1.0.35):
preloads/to SEA binary directoryapp.jsto preferdirname(process.execPath)