Skip to content

fix(security): purge indexed tool descriptions when REST PATCH quarantines a server (#1561) - #1582

Merged
Dumbris merged 2 commits into
mainfrom
fix/1561-patch-quarantine-purge-index
Oct 12, 2026
Merged

Dumbris merged 2 commits into
mainfrom
fix/1561-patch-quarantine-purge-index

Conversation

@Dumbris

@Dumbris Dumbris commented Oct 11, 2026

Copy link
Copy Markdown
Member

Impact

PATCH /api/v1/servers/{name} with {"quarantined":true} persisted the flag but left the server's tool descriptions in the search index. retrieve_tools kept returning them (15 hits in the live repro, still there 4s later), so a quarantined server's possibly poisoned descriptions stayed visible to agents. Same class as #1061, through a different writer.

Cause

The purge lived only in Runtime.QuarantineServer and in reconcile's newly-quarantined check, which compares against storage. Server.UpdateServer (the PATCH writer) saved the flag first, so reconcile never saw a transition.

Decisions

  • Reuse the existing helper: new exported Runtime.PurgeQuarantinedServerFromIndex delegates to purgeQuarantinedServerFromIndex (global and profile indexes). No duplicated logic.
  • UpdateServer calls it right after the flag is saved, before the change notification, whenever the caller explicitly set quarantined to true (not on a stale copied false/true, not on unquarantine).
  • The config commit path is untouched (bug: MCP/REST update, patch, quarantine and enable bypass the config commit lock (resurrect removed servers, revert security fields) #1560 owns it).
  • Unquarantine direction is covered by the existing runtime test; a server-level "left alone" test would race the unrelated async reindex that follows every update.

Verification

  • New TestUpdateServer_QuarantineTrue_PurgesIndexedTools: fails on main, passes with the fix (-race, count 5). Runtime and httpapi quarantine/purge tests pass.
  • Live, big profile, baseline vs fix: PATCH quarantined:true leaves 15 retrieve_tools hits on main and 0 with the fix; describe_tool returns not_found; the dedicated endpoint behaves the same; PATCH quarantined:false re-indexes.

Fixes #1561

🤖 Generated with Claude Code

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: fix/1561-patch-quarantine-purge-index

Available Artifacts

  • archive-darwin-amd64 (31 MB)
  • archive-darwin-arm64 (28 MB)
  • archive-linux-amd64 (19 MB)
  • archive-linux-arm64 (17 MB)
  • archive-windows-amd64 (31 MB)
  • archive-windows-arm64 (27 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (27 MB)
  • installer-dmg-darwin-arm64 (24 MB)
  • smart-mcp-proxymcpproxy-goCXYYS5.dockerbuild (0 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 38150884168 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@codecov-commenter

codecov-commenter commented Oct 11, 2026 •

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 75.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/runtime/lifecycle.go 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Dumbris
Dumbris merged commit 71702cf into main Oct 12, 2026
52 of 55 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.

security: REST PATCH quarantined=true does not purge the server's indexed tool descriptions

2 participants