Skip to content

fix(agent-audit): name project MCP servers that run the checkout's own code, and unpinned npx/uvx runners - #1129

Merged
sandstream merged 1 commit into
mainfrom
claude/web-kit-status-sync-p6fg9a-protected-audit-mcp-local-code
Nov 27, 2026
Merged

sandstream merged 1 commit into
mainfrom
claude/web-kit-status-sync-p6fg9a-protected-audit-mcp-local-code

Conversation

@sandstream

Copy link
Copy Markdown
Owner

Protected — owner merges (touches src/agent-audit.ts, in the secrets set: a comment, one import, and one call).

Sources:

  • kit-research#236 (artex-cc-vs-kit), Measurement §3 and Plan step 3: ARTEX-CC's committed .mcp.json runs go run ./cmd/artex-cc serve --stdio --pg ${ARTEX_PG}.
  • kit-research shrink-anything-vs-kit: the same npx -y <pkg> MCP entry is "unpinned" to kit triage skill and passed by kit agent-audit.

(a) Runs repository code at session start

src/agent-audit-mcp-launch.ts reads each stdio server in every project config runAgentAudit reads (.mcp.json, .claude.json, .cursor/mcp.json, .vscode/mcp.json, opencode.json(c), and Codex config.toml through configView). It warns, severity low, with "runs repository code at session start" when the command is one of:

  • go run on ./…, . or a .go file;
  • cargo run;
  • node, bun, deno run, tsx, ts-node or python on a relative path, or on ${workspaceFolder} / ${CLAUDE_PROJECT_DIR};
  • python -m <pkg> where <pkg> is a directory or .py in the checkout (or src/);
  • npm|pnpm|yarn|bun|uv run;
  • a relative command (./bin/server).

Not flagged: go run github.com/x/y@v1, deno run jsr:…, python -m http.server, absolute paths, docker run, and npx <pkg>.

Why a warning and not a failure: building your own server from source is normal inside that server's own repository. The risk is that any commit or branch decides what runs with the agent's credentials. That is worth a line, not a red build.

(b) npx -y <pkg> / uvx <pkg> without a version

The reason for the old behaviour, read first. The comment on auditMcpStdio (src/agent-audit.ts, lines 141–147 on main) says: "We do NOT flag the common-and-legitimate npx <pkg> shape (that would warn on almost every config — noise is the #1 reason security tooling gets ignored)." That is a deliberate decision recorded in code. No ADR or doc states it.

Choice: keep it. An unpinned runner is still not a failure. But agent-audit now gives a low warning, unpinned MCP runner "<name>" in <file>, that names the runner and the package. So both commands now call the same entry unpinned. The runner list (npx, bunx, uvx, pnpm dlx, yarn dlx, pipx run) and the pinned test (name@<digit>…, @scope/name@<digit>…) are copied from the triage skill's RUNNER and _pinned (skills/triage/scripts/plugin_scan.py). So x@latest and uvx pkg==1.0 are unpinned in both commands, and @scope/x@1.2.3 is pinned in both. The comment on auditMcpStdio now points to the warning.

Before / after

scripts/mcp-demo.sh (scratch): a .mcp.json with ARTEX-CC's server and shrink-anything's npx -y @el4cteo/shrink-anything mcp.

Before (origin/main):

✓ agent-audit  no issues in 1 agent config(s) + 0 git hook file(s) + 0 command/agent/skill/plugin file(s)

After:

! MCP server "artex" in .mcp.json runs repository code at session start  `go run ./cmd/artex-cc` builds or runs this checkout's own code each time an agent starts the server, once the project server ...
! unpinned MCP runner "shrink" in .mcp.json  `npx @el4cteo/shrink-anything` runs the newest published version at every session start (unpinned), as `kit triage skill` reports it

Test: src/agent-audit-mcp-launch.test.ts. It includes the triage skill's own fixture (npx -y lookup-server-fixture@latest, in .mcp.json and in Codex's config.toml). On main, the module does not exist and runAgentAudit returns the single pass row. On this branch, 5/5 pass, and the existing agent-audit*, check-agent-config and triage-skill-pack-hooks tests pass (97 in total).

Harness coverage, and choices for the owner

macOS is unverified. The only file access is existsSync on node:path-joined paths for python -m.


Generated by Claude Code

…unpinned runners

A project MCP server whose command builds or runs the checkout's own code
(go run ./..., cargo run, node ./..., python -m <local package>, npm run,
uv run, a relative command) now gets a low warning, "runs repository code
at session start" (kit-research artex-cc-vs-kit: ARTEX-CC's .mcp.json runs
`go run ./cmd/artex-cc`).

`npx -y <pkg>` and `uvx <pkg>` without a version were "unpinned" to
`kit triage skill` and passed by `kit agent-audit` on purpose (a failure on
every npx config is noise, per the comment on auditMcpStdio). The choice
stands: it is not a failure. agent-audit now gives a low warning with the
triage skill's runner list and pinned test, so both commands call the same
entry unpinned (kit-research shrink-anything-vs-kit).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Docker image built, scanned, and smoke-tested in CI. The PR image is local to this run and is not published.

@sandstream-kit-reviewer sandstream-kit-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kit review gate at e9ba21d6db86: not approved.

  • touches protected paths (secrets), which the owner approves: src/agent-audit.ts

@sandstream
sandstream merged commit 418d0e8 into main Nov 27, 2026
33 checks passed
@sandstream
sandstream deleted the claude/web-kit-status-sync-p6fg9a-protected-audit-mcp-local-code branch November 27, 2026 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants