Repository navigation
Conversation
The source resolver matched runner commands by exact base name, so a Windows server launched with npx.cmd, uvx.exe or pnpm.cmd was not a package runner. The package-cache-first lookup was skipped, letting arg scanning pick a data-dir argument as server source, and the published package fetch never ran. Strip a .exe, .cmd or .bat suffix (and lowercase) wherever the runner name is derived.
rudycelekli
force-pushed
the
fix/scanner-runner-windows-ext-20261024-01
branch
from
October 24, 2026 22:18
eaad1cd to
6b702d6
Compare
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Dumbris
approved these changes
Oct 26, 2026
Dumbris
left a comment
Member
There was a problem hiding this comment.
Verified: the PR test fails on main for the reason described and passes on this branch merged with main; race tests for the touched packages and CI lint (bare and server tags) are clean. Also built and tested together with the rest of this batch, independently reviewed, and cross-reviewed with a second model.
Member
|
Merged. Thank you, @rudycelekli! The scanner recognises |
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.
Problem
The security scanner's source resolver gets the runner name from
filepath.Base(info.Command)and compares it exactly againstnpx,uvx,pnpmand so on. On Windows the command is commonlynpx.cmd,uvx.exeorpnpm.cmd, so:isPackageRunnerCommandreturns false and the package-cache-first lookup is skipped. Arg scanning can then pick a data-dir argument (for example the filesystem server's allowed root) as the server source, which is the case that ordering exists to prevent.resolveFromPackageFetch) is gated on the same check, so a quarantined server falls back to a tool-definitions-only scan.npxTargetPackageanduvxTargetPackagereturn "".Fix
Add
runnerBase(command), which returns the lowercased base name with a.exe,.cmdor.batsuffix removed. Use it everywhere the runner name is derived:isPackageRunnerCommand,npxTargetPackage,uvxTargetPackage,resolveFromPackageCache, the tworunnerPackageSpeccalls, and the package-fetch dispatch. Unsuffixed names are unchanged.Test
TestPackageRunner_WindowsExecutableSuffixcoversnpx.cmd,NPX.CMD,uvx.exeandpnpm.cmd dlx, a non-runnernode.exe, and the npx/uvx target-package helpers. On main the four runner checks and both target lookups fail; with this change they pass.go test -count=1 ./internal/security/scanner/passes.Made with Cursor