Skip to content

feat(quarantine): trust-baseline tool approval + rug-pull flag + migration (MCP-2931)#726

Merged
Dumbris merged 2 commits into
mainfrom
feat/mcp2931-trust-baseline-tool-approval
Jun 19, 2026
Merged

feat(quarantine): trust-baseline tool approval + rug-pull flag + migration (MCP-2931)#726
Dumbris merged 2 commits into
mainfrom
feat/mcp2931-trust-baseline-tool-approval

Conversation

@Dumbris

@Dumbris Dumbris commented Jun 19, 2026

Copy link
Copy Markdown
Member

Summary

Implements the trust-based tool-approval model (MCP-2931, parent MCP-2916) in internal/runtime/tool_quarantine.go. This is the security-sensitive core that fixes the reporter's case where a quarantined:false server still stranded its tools as pending.

Behavior

  1. Trust event = baseline auto-approval. A trusted (server-level NOT quarantined) server with no prior approved baseline auto-approves its current toolset as the baseline (status approved, approved_by:"auto-baseline") instead of pending. Covers config-loaded quarantined:false servers (discovery path) and the server-unquarantine promotion path.
  2. Post-baseline review (default, auto_approve_tool_changes:false): an approved tool whose hash changes → changed (rug pull) → blocked; a genuinely-new post-baseline tool → pending → blocked.
  3. auto_approve_tool_changes:true: auto-approves all post-baseline changes AND additions for that server — no changed/pending (consumes the MCP-2930 flag; legacy skip_quarantine migrates onto it).
  4. Migration for existing installs: a trusted server with no approved baseline promotes already-stranded pending records (whose stored hash matches the live tool) to approved on the next discovery pass — clears the reporter's case with no user action. A changed (rug-pull) record is never cleared by migration.
  5. Two-gate consistency: index blocking (BlockedTools) now keys off stored pending status regardless of server-level quarantine, matching the call-time gate (internal/server/mcp.go). A tool is never indexed/visible-but-uncallable.

Invariant safety

Two new transition reasons (ReasonBaselineTrust, ReasonAutoApproveChanges) keep assertToolApprovalInvariant explicit: a changed record may only be cleared by explicit user action or the explicit per-server auto_approve_tool_changes flag. Rug-pull detection is not weakened on any default path.

Tests (TDD red→green)

New internal/runtime/tool_quarantine_trust_baseline_test.go covers: baseline auto-approve; post-baseline new→pending; post-baseline rug-pull→changed; auto_approve_tool_changes bypass of new+changed and clearing an existing changed; stranded-pending migration; migration does-not-clear-changed; two-gate consistency across passes. Existing trusted-server tests updated to the new model; heavy rapid property invariant tests (on quarantined servers) still green.

Verification

  • go test ./internal/runtime/... ./internal/server/... -short -race → green (no data races).
  • Heavy property tests (TestRapidQuarantineStateMachine, *NeverAutoApproved) → green.
  • golangci-lint run --config .github/.golangci.yml ./internal/runtime/... ./internal/server/... → 0 issues.

Docs (ENG-9)

docs/features/tool-quarantine.md, docs/features/security-quarantine.md, docs/configuration.md, CLAUDE.md updated to describe the trust-baseline model, the now-enforced auto_approve_tool_changes, and the migration.

Parent: MCP-2916. Related: MCP-2930 (#724).

…ation (MCP-2931)

Implements the trust-based tool-approval model. A trusted (non-quarantined)
server's CURRENT toolset auto-approves as its baseline (approved_by
"auto-baseline") instead of stranding as pending. Post-baseline review still
applies: an approved tool whose hash changes flips to changed (rug pull) and a
genuinely-new tool flips to pending — both blocked — unless the per-server
auto_approve_tool_changes flag (MCP-2930) is set, which auto-approves all
post-baseline changes AND additions for that server.

Existing installs are migrated automatically: a trusted server with no approved
baseline promotes its already-stranded pending records (whose stored hash
matches the live tool) to approved on the next discovery pass, clearing the
reporter's case with no user action. A changed (rug-pull) record is NEVER
cleared by migration.

Two-gate consistency: index blocking (BlockedTools) now keys off stored pending
status regardless of server-level quarantine, matching the call-time gate
(internal/server/mcp.go), so a tool is never indexed/visible-but-uncallable.

New transition reasons (ReasonBaselineTrust, ReasonAutoApproveChanges) keep the
approval invariant explicit: only user action or the explicit per-server flag
may clear a changed record. TDD red→green tests cover every transition.

Parent: MCP-2916.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 19, 2026

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5485583
Status: ✅  Deploy successful!
Preview URL: https://643f99f7.mcpproxy-docs.pages.dev
Branch Preview URL: https://feat-mcp2931-trust-baseline.mcpproxy-docs.pages.dev

View logs

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 74.35897% with 30 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/runtime/tool_quarantine.go 74.35% 25 Missing and 5 partials ⚠️

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown

📦 Build Artifacts

Workflow Run: View Run
Branch: feat/mcp2931-trust-baseline-tool-approval

Available Artifacts

  • archive-darwin-amd64 (28 MB)
  • archive-darwin-arm64 (25 MB)
  • archive-linux-amd64 (16 MB)
  • archive-linux-arm64 (14 MB)
  • archive-windows-amd64 (28 MB)
  • archive-windows-arm64 (25 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (21 MB)
  • installer-dmg-darwin-arm64 (19 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 27822638601 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@mcpproxy-gatekeeper mcpproxy-gatekeeper 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.

Approved via Claude Code review (MCP-2931). Trust-baseline tool approval: baseline auto-approve on trusted servers, post-baseline rug-pull/new→blocked, auto_approve_tool_changes flag bypass, safe migration (never clears a rug-pull), two-gate index/call consistency fixed. 8 new TDD tests + strengthened rapid property tests; go build both editions; -race tests pass; golangci-lint 0 issues.

# Conflicts:
#	docs/features/tool-quarantine.md
@Dumbris Dumbris merged commit e8d98a7 into main Jun 19, 2026
38 checks passed
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