Commit 0041dfd
committed
fix(scanner): require subcommand keyword for subcommand-style runners
Codex re-review (MCP-2445): runnerPackageSpec returned the first positional
even when the runner's required subcommand keyword was absent, so with
pnpm/yarn/bun gated as package runners:
pnpm start -> "start"
bun server.ts -> "server.ts"
pipx install x -> "install"
The wrong token was then fetched/scanned = false coverage + typosquat risk.
Fix: for subcommand-style runners (pnpm/yarn `dlx`, `bun x`, `pipx run`), a
package spec is resolved ONLY when the keyword is present. A bare local
invocation (`pnpm start`, `bun server.ts`, `pipx install foo`) now yields ""
(no package) and degrades to tool-definitions-only instead of fetching a
bogus package. npx/uvx/bunx (no subcommand) are unchanged.
TDD: added pnpm start / pnpm run build / bun server.ts / bun run dev /
yarn build / pipx install cases (-> ""); pnpm dlx <pkg> / npx -y <pkg> /
uvx --from still resolve. Rebased onto origin/main (picks up #676
archive-extraction hardening + the teams/broker -> serveredition/broker move).
Related MCP-24451 parent 3405e9d commit 0041dfd
2 files changed
Lines changed: 25 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
172 | 174 | | |
173 | 175 | | |
174 | 176 | | |
| |||
198 | 200 | | |
199 | 201 | | |
200 | 202 | | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
205 | 216 | | |
206 | 217 | | |
207 | 218 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
64 | 73 | | |
65 | 74 | | |
66 | 75 | | |
| |||
0 commit comments