Repository navigation
fix(desktop): resolve Windows npx stdio MCP via node and fnm (v2) - #1017
Merged
Merged
Conversation
Cherry-pick PR #1012 with security fixes: - quoteWindowsCmdArg: escape % as %% so cmd.exe does not expand env vars - wrapCmdShim: wrap the /s /c line in outer quotes so paths with spaces survive cmd.exe's first/last quote stripping (prevents injection) - defaultFs.isFile: return false on statSync error instead of existsSync which could match directories - Remove bun/bunx from NODE_LAUNCHERS (dead path: bun has its own install location unrelated to node) fixes #789
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
Cherry-pick of #1012 with security fixes for the review findings.
Changes from the original PR
wrapCmdShimmissing outer quotes —cmd.exe /s /cstrips first+last quote, breaking paths with spaces and enabling injectionargs: ["/d", "/s", "/c","${line}"]quoteWindowsCmdArgdoes not escape%— cmd.exe expands%VAR%inside double quotesarg.replace(/%/g, "%%")before quote-doublingdefaultFs.isFilefalls back toexistsSyncwhich matches directoriesfalseonstatSyncerror; remove unusedexistsSyncimportbun/bunxinNODE_LAUNCHERS— dead path since bun has its own install locationNew test coverage
wrapCmdShim outer-quotes survive when .cmd path contains spaces— path with spaces + metachar args + embedded quotes%escaping assertions incmd quoting keeps metacharacters inside one argumentTest plan
node --test apps/desktop/test/mcp-stdio-launch.test.mjs(15 pass)node --test apps/desktop/test/plugin-mcp.test.mjs plugin-child-env.test.mjs extensions-page.test.mjs(64 pass total)fixes #789
supersedes #1012