Skip to content

security: harden MCP server tool path and health check environment#1

Merged
m1ngshum merged 3 commits intomainfrom
claude/security-review-MqPzv
Mar 30, 2026
Merged

security: harden MCP server tool path and health check environment#1
m1ngshum merged 3 commits intomainfrom
claude/security-review-MqPzv

Conversation

@m1ngshum
Copy link
Copy Markdown
Member

  • Add trust score gate to MCP server handleInstall (rejects servers
    below score 50 by default). Unlike the CLI which has a human
    confirmation prompt, the MCP tool path is driven by AI agents with
    no human in the loop — a malicious prompt could trick an agent into
    installing a dangerous server.

  • Sanitize environment variables passed to health check subprocesses.
    Strip known sensitive vars (AWS_SECRET_ACCESS_KEY, GITHUB_TOKEN,
    ANTHROPIC_API_KEY, etc.) from process.env before spawning untrusted
    MCP servers during verification. Server-declared env vars (user-
    provided during install) are preserved.

  • Add server name validation at the MCP tool boundary. AI agents
    provide name strings that could be influenced by prompt injection;
    validate format (namespace/name, alphanumeric) before processing.

  • Fix --force flag: addServer adapter now accepts { force: true } to
    allow overwriting existing entries. Previously --force skipped the
    pre-check but the adapter independently rejected duplicates.

All 697 tests pass.

https://claude.ai/code/session_01SZPPoWcw88dcxYmgfavG6X

claude added 3 commits March 30, 2026 11:16
- Add trust score gate to MCP server handleInstall (rejects servers
  below score 50 by default). Unlike the CLI which has a human
  confirmation prompt, the MCP tool path is driven by AI agents with
  no human in the loop — a malicious prompt could trick an agent into
  installing a dangerous server.

- Sanitize environment variables passed to health check subprocesses.
  Strip known sensitive vars (AWS_SECRET_ACCESS_KEY, GITHUB_TOKEN,
  ANTHROPIC_API_KEY, etc.) from process.env before spawning untrusted
  MCP servers during verification. Server-declared env vars (user-
  provided during install) are preserved.

- Add server name validation at the MCP tool boundary. AI agents
  provide name strings that could be influenced by prompt injection;
  validate format (namespace/name, alphanumeric) before processing.

- Fix --force flag: addServer adapter now accepts { force: true } to
  allow overwriting existing entries. Previously --force skipped the
  pre-check but the adapter independently rejected duplicates.

All 697 tests pass.

https://claude.ai/code/session_01SZPPoWcw88dcxYmgfavG6X
@m1ngshum m1ngshum merged commit 728b612 into main Mar 30, 2026
4 checks passed
@m1ngshum m1ngshum deleted the claude/security-review-MqPzv branch March 30, 2026 11:59
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