Repository navigation
fix(skills): run npx without cmd.exe in generated Windows scripts - #4543
Merged
Merged
Conversation
In npx mode, generated wrapper scripts ran npx.cmd with shell: true on Windows, so tool arguments were parsed by cmd.exe. Run npm's npx-cli.js with process.execPath and no shell instead, and exit with an error if npx-cli.js cannot be found.
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the generated script's npx invocation on Windows to run npx-cli.js directly via Node.js, bypassing cmd.exe to prevent argument parsing issues. The accompanying tests have been updated to verify this behavior. The review feedback highlights a potential issue where non-standard Node.js installations (such as Volta) might not have npx-cli.js at the expected path, causing a hard failure. It is recommended to implement a fallback to the original npx.cmd execution with shell-escaping logic if npx-cli.js is not found.
averikitsch
approved these changes
Nov 19, 2026
Contributor
|
🧨 Preview deployments removed. Cloudflare Pages environments for |
AlexTalreja
added a commit
that referenced
this pull request
Nov 20, 2026
🤖 I have created a release *beep* *boop* --- ## [1.18.0](v1.17.0...v1.18.0) (2026-11-20) ### Features * **tool/clickhouse-execute-sql:** Bind query parameters on the server ([#4354](#4354)) ([ef822ce](ef822ce)) ### Bug Fixes * **auth/google:** Require clientId when mcpEnabled is false ([#3676](#3676)) ([a5dc5d4](a5dc5d4)) * **cmd:** Run telemetry shutdown with an uncanceled bounded context ([#4148](#4148)) ([dcdbbae](dcdbbae)) * **config:** Reject multiple mcpEnabled auth services of any type ([#4542](#4542)) ([db52312](db52312)) * **parameters:** Copy valueFromParam from the resolved source value ([#4541](#4541)) ([5a36ba0](5a36ba0)) * **parameters:** Enforce full-input matching in MatchStringOrRegex ([#4522](#4522)) ([7f366ff](7f366ff)) * **parameters:** Reject delimiters and backslashes in applyEscape ([#4523](#4523)) ([a3d013f](a3d013f)) * **prebuilt/sqlite:** Bind query parameters in list_tables ([#4535](#4535)) ([9a8a4f0](9a8a4f0)) * **resource/file:** Enforce URI template prefix, suffix, and directory boundary ([#4538](#4538)) ([5e894e4](5e894e4)) * **server,tool/conversational-analytics:** Resolve CodeQL dynamic call and allocation alerts ([#4489](#4489)) ([3bb1e24](3bb1e24)) * **server/mcp:** Preserve integer argument precision ([#4435](#4435)) ([a09d12d](a09d12d)) * **skills:** Run npx without cmd.exe in generated Windows scripts ([#4543](#4543)) ([ae8f790](ae8f790)) * **source/cloudmonitoring:** Validate projectId before building the query URL ([#4544](#4544)) ([6b3d6b4](6b3d6b4)) * **source/databaseinsights:** Validate parent resource name before building endpoint ([#4532](#4532)) ([0e9fc2f](0e9fc2f)) * **source/mssql,source/cloudsqlmssql:** Include the server's messages in severe errors ([#4445](#4445)) ([d6b2bd7](d6b2bd7)) * **sqlite:** Preserve JSON number precision in tool results ([#4431](#4431)) ([ff59dce](ff59dce)) * **tool/bigquery-analyze-contribution:** Apply maximumBytesBilled to CREATE TEMP MODEL job ([#4531](#4531)) ([d7fd6c5](d7fd6c5)) * **tool/postgres-database-overview:** Count only client backends as connections ([#4463](#4463)) ([9a17f8b](9a17f8b)) * **tool/postgres-get-column-cardinality:** Return one row per column for tables with inheritance children ([#4413](#4413)) ([1cb1952](1cb1952)) * **tool/postgres-list-indexes:** Include indexes on materialized views ([#4504](#4504)) ([2253fe7](2253fe7)) * **tool/postgres-list-roles:** Escape underscore in system role filters ([#4380](#4380)) ([05f20fe](05f20fe)) * **tool/postgres-replication-stats:** Support running replication_stats and list_replication_slots on a standby ([#4471](#4471)) ([2b6d51f](2b6d51f)) * **tool/redis,tool/valkey:** Send integer, float and boolean parameters as their value ([#4378](#4378)) ([6fe3da9](6fe3da9)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Juexin Wang <[email protected]> Co-authored-by: alextalreja <[email protected]> Co-authored-by: Alex Talreja <[email protected]>
github-actions Bot
pushed a commit
that referenced
this pull request
Nov 20, 2026
🤖 I have created a release *beep* *boop* --- ## [1.18.0](v1.17.0...v1.18.0) (2026-11-20) ### Features * **tool/clickhouse-execute-sql:** Bind query parameters on the server ([#4354](#4354)) ([ef822ce](ef822ce)) ### Bug Fixes * **auth/google:** Require clientId when mcpEnabled is false ([#3676](#3676)) ([a5dc5d4](a5dc5d4)) * **cmd:** Run telemetry shutdown with an uncanceled bounded context ([#4148](#4148)) ([dcdbbae](dcdbbae)) * **config:** Reject multiple mcpEnabled auth services of any type ([#4542](#4542)) ([db52312](db52312)) * **parameters:** Copy valueFromParam from the resolved source value ([#4541](#4541)) ([5a36ba0](5a36ba0)) * **parameters:** Enforce full-input matching in MatchStringOrRegex ([#4522](#4522)) ([7f366ff](7f366ff)) * **parameters:** Reject delimiters and backslashes in applyEscape ([#4523](#4523)) ([a3d013f](a3d013f)) * **prebuilt/sqlite:** Bind query parameters in list_tables ([#4535](#4535)) ([9a8a4f0](9a8a4f0)) * **resource/file:** Enforce URI template prefix, suffix, and directory boundary ([#4538](#4538)) ([5e894e4](5e894e4)) * **server,tool/conversational-analytics:** Resolve CodeQL dynamic call and allocation alerts ([#4489](#4489)) ([3bb1e24](3bb1e24)) * **server/mcp:** Preserve integer argument precision ([#4435](#4435)) ([a09d12d](a09d12d)) * **skills:** Run npx without cmd.exe in generated Windows scripts ([#4543](#4543)) ([ae8f790](ae8f790)) * **source/cloudmonitoring:** Validate projectId before building the query URL ([#4544](#4544)) ([6b3d6b4](6b3d6b4)) * **source/databaseinsights:** Validate parent resource name before building endpoint ([#4532](#4532)) ([0e9fc2f](0e9fc2f)) * **source/mssql,source/cloudsqlmssql:** Include the server's messages in severe errors ([#4445](#4445)) ([d6b2bd7](d6b2bd7)) * **sqlite:** Preserve JSON number precision in tool results ([#4431](#4431)) ([ff59dce](ff59dce)) * **tool/bigquery-analyze-contribution:** Apply maximumBytesBilled to CREATE TEMP MODEL job ([#4531](#4531)) ([d7fd6c5](d7fd6c5)) * **tool/postgres-database-overview:** Count only client backends as connections ([#4463](#4463)) ([9a17f8b](9a17f8b)) * **tool/postgres-get-column-cardinality:** Return one row per column for tables with inheritance children ([#4413](#4413)) ([1cb1952](1cb1952)) * **tool/postgres-list-indexes:** Include indexes on materialized views ([#4504](#4504)) ([2253fe7](2253fe7)) * **tool/postgres-list-roles:** Escape underscore in system role filters ([#4380](#4380)) ([05f20fe](05f20fe)) * **tool/postgres-replication-stats:** Support running replication_stats and list_replication_slots on a standby ([#4471](#4471)) ([2b6d51f](2b6d51f)) * **tool/redis,tool/valkey:** Send integer, float and boolean parameters as their value ([#4378](#4378)) ([6fe3da9](6fe3da9)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Juexin Wang <[email protected]> Co-authored-by: alextalreja <[email protected]> Co-authored-by: Alex Talreja <[email protected]>
github-actions Bot
pushed a commit
to renovate-bot/googleapis-_-genai-toolbox
that referenced
this pull request
Nov 21, 2026
🤖 I have created a release *beep* *boop* --- ## [1.18.0](googleapis/mcp-toolbox@v1.17.0...v1.18.0) (2026-11-20) ### Features * **tool/clickhouse-execute-sql:** Bind query parameters on the server ([googleapis#4354](googleapis#4354)) ([ef822ce](googleapis@ef822ce)) ### Bug Fixes * **auth/google:** Require clientId when mcpEnabled is false ([googleapis#3676](googleapis#3676)) ([a5dc5d4](googleapis@a5dc5d4)) * **cmd:** Run telemetry shutdown with an uncanceled bounded context ([googleapis#4148](googleapis#4148)) ([dcdbbae](googleapis@dcdbbae)) * **config:** Reject multiple mcpEnabled auth services of any type ([googleapis#4542](googleapis#4542)) ([db52312](googleapis@db52312)) * **parameters:** Copy valueFromParam from the resolved source value ([googleapis#4541](googleapis#4541)) ([5a36ba0](googleapis@5a36ba0)) * **parameters:** Enforce full-input matching in MatchStringOrRegex ([googleapis#4522](googleapis#4522)) ([7f366ff](googleapis@7f366ff)) * **parameters:** Reject delimiters and backslashes in applyEscape ([googleapis#4523](googleapis#4523)) ([a3d013f](googleapis@a3d013f)) * **prebuilt/sqlite:** Bind query parameters in list_tables ([googleapis#4535](googleapis#4535)) ([9a8a4f0](googleapis@9a8a4f0)) * **resource/file:** Enforce URI template prefix, suffix, and directory boundary ([googleapis#4538](googleapis#4538)) ([5e894e4](googleapis@5e894e4)) * **server,tool/conversational-analytics:** Resolve CodeQL dynamic call and allocation alerts ([googleapis#4489](googleapis#4489)) ([3bb1e24](googleapis@3bb1e24)) * **server/mcp:** Preserve integer argument precision ([googleapis#4435](googleapis#4435)) ([a09d12d](googleapis@a09d12d)) * **skills:** Run npx without cmd.exe in generated Windows scripts ([googleapis#4543](googleapis#4543)) ([ae8f790](googleapis@ae8f790)) * **source/cloudmonitoring:** Validate projectId before building the query URL ([googleapis#4544](googleapis#4544)) ([6b3d6b4](googleapis@6b3d6b4)) * **source/databaseinsights:** Validate parent resource name before building endpoint ([googleapis#4532](googleapis#4532)) ([0e9fc2f](googleapis@0e9fc2f)) * **source/mssql,source/cloudsqlmssql:** Include the server's messages in severe errors ([googleapis#4445](googleapis#4445)) ([d6b2bd7](googleapis@d6b2bd7)) * **sqlite:** Preserve JSON number precision in tool results ([googleapis#4431](googleapis#4431)) ([ff59dce](googleapis@ff59dce)) * **tool/bigquery-analyze-contribution:** Apply maximumBytesBilled to CREATE TEMP MODEL job ([googleapis#4531](googleapis#4531)) ([d7fd6c5](googleapis@d7fd6c5)) * **tool/postgres-database-overview:** Count only client backends as connections ([googleapis#4463](googleapis#4463)) ([9a17f8b](googleapis@9a17f8b)) * **tool/postgres-get-column-cardinality:** Return one row per column for tables with inheritance children ([googleapis#4413](googleapis#4413)) ([1cb1952](googleapis@1cb1952)) * **tool/postgres-list-indexes:** Include indexes on materialized views ([googleapis#4504](googleapis#4504)) ([2253fe7](googleapis@2253fe7)) * **tool/postgres-list-roles:** Escape underscore in system role filters ([googleapis#4380](googleapis#4380)) ([05f20fe](googleapis@05f20fe)) * **tool/postgres-replication-stats:** Support running replication_stats and list_replication_slots on a standby ([googleapis#4471](googleapis#4471)) ([2b6d51f](googleapis@2b6d51f)) * **tool/redis,tool/valkey:** Send integer, float and boolean parameters as their value ([googleapis#4378](googleapis#4378)) ([6fe3da9](googleapis@6fe3da9)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Juexin Wang <[email protected]> Co-authored-by: alextalreja <[email protected]> Co-authored-by: Alex Talreja <[email protected]>
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.
Description
Node.js wrapper scripts generated by
skills-generateinnpxmode runnpx.cmdwithshell: trueon Windows, so the tool arguments (the JSONpayload from the agent) are parsed by
cmd.exe, which can reinterpret quote,%and&characters in them. Spawningnpx.cmdwithout a shell is not anoption, because Node.js refuses to spawn
.cmdfiles withoutshell: truesince the CVE-2024-27980 fix.
On Windows the scripts now run npm's
npx-cli.js(installed next to therunning
nodeexecutable) withprocess.execPathand no shell, so thearguments reach
npxunchanged. Ifnpx-cli.jsis not found, the script exitswith an error instead of falling back to the shell. Behavior on other platforms
is unchanged.
Testing
TestGenerateScriptContent(npx mode) now requires thenpx-cli.jsinvocation and rejects
shell:and'npx.cmd'.npx-mode skill and ran its script under Node withos.platform()stubbed towin32andspawncaptured: the JSON argument ispassed to
node npx-cli.js ...as a single unmodified argument with noshell, and a missing
npx-cli.jsexits with an error. The Linux invocationis unchanged.
go test ./cmd/internal/skills/...PR Checklist
CONTRIBUTING.md
review