Fix mCP server declaration resolves code at run time in VS Code
An MCP server is launched with `npx -y`, `uvx`, `bunx`, or a container image with no digest, or is reached over a remote transport. The code that gets a tool call today is not necessarily the code that got one yesterday, and there is no version in the repository to review.
medium likely VS Code CWE-1357 / ASI ASI04
The vulnerable pattern in VS Code
This finding comes from the VS Code fixture in the owlwarden test suite. `x` resolves its package at run time with no version pinned, so today's code is whatever the registry serves. Whoever controls what that name resolves to controls a process holding tool access to this workspace.
The corrected configuration
Pin the version in the `mcp` block of `.vscode/settings.json`, or use a container image by digest. `latest` in a workspace file is a moving target every contributor inherits.
// .vscode/settings.json
"mcp": { "servers": { "db": { "command": "npx", "args": ["-y", "mcp-db@1.4.2"] } } }
If you are not using VS Code
Pin the version or the digest, and prefer a dependency in `devDependencies` over a run-time resolve. For a remote transport, state the trust decision in the config - a comment naming who runs the endpoint - rather than leaving it implicit.
Check your own repository
npx owlwarden scan
npx owlwarden explain agent-mcp-unpinned-remote
Runs on your machine. No account, no telemetry, no network unless you ask. In CI, SARIF uploads to code scanning and the exit code is the gate.
Other VS Code checks
Rules with a tested VS Code example.
- agent-config-env-redirect high Repository config redirects the agent's API traffic
- agent-config-loader-script high Executable script inside an agent or editor config directory
- agent-config-secret-reachable high Repository config puts credentials in reach of a repository-controlled command
- agent-hook-autoexec high Repository config executes a command when the workspace is opened
- agent-hook-untrusted-command high Hook command reaches outside the project
- agent-permission-wildcard medium Repository config pre-approves a broad tool permission
agent-mcp-unpinned-remote for every agent host / All rules / owlwarden