Repository navigation
Description
Summary
Quarantining a server by editing the config file does not purge its tools from the Bleve index. retrieve_tools then returns that server's tool names, full descriptions and a call_with variant as ordinary callable results, until something else happens to reindex. The call itself is still refused, so this is a disclosure bug, not an execution bug — but disclosure of untrusted tool descriptions is precisely what quarantine exists to prevent, since that is where a Tool Poisoning Attack payload lives.
The same transition applied through POST /api/v1/servers/{id}/quarantine purges correctly. Only the config-file / hot-reload path is affected.
Why this matters more than a normal stale-index bug
The search path has no query-time quarantine filter on the description-bearing branch. Index absence is the control, and the code says so — internal/server/mcp.go:1743:
// Quarantined tools are deliberately absent from the search index: their
// untrusted descriptions/schemas are withheld so a Tool Poisoning Attack
// payload is never exposed to the agent. The loop above therefore can never
// surface them, and an agent searching for a capability a quarantined server
// provides would be told "no such tool". Enumerate those tools from
// authoritative state ... and prepend name-only locked entries (no
// description/schema) ...The same block already anticipates index lag, but only as a transient:
// `seen` dedupes against tools the loop already handled — primarily for the
// brief window after a runtime quarantine toggle when a tool may still
// linger in the indexOn the config-file path that window is not brief. Nothing ever closes it: the tools stay indexed, keep their descriptions, and are returned as normal results rather than the name-only locked entries the design intends.
Reproduction
Verified on main @ 4d30624 (v0.61.0), isolated instance, scratch --config and --data-dir.
- Start a core with an stdio server (
@modelcontextprotocol/server-memory) and let it connect and index — 9 tools. - Edit the config file, setting
"quarantined": trueon that server. Save; the file watcher hot-reloads. GET /api/v1/servers→quarantined: true,tool_count: 9.- Call
retrieve_toolswith{"query": "create entities in a knowledge graph"}.
Actual:
servers surfaced: ['memory']
- memory:create_entities | call_with: call_tool_write | Create multiple new entities in the knowledge graph
- memory:create_relations | call_with: call_tool_write | Create multiple new relations between entities …
- memory:delete_entities | call_with: call_tool_destructive | Delete multiple entities and their associated relations …
- memory:delete_observations | call_with: call_tool_destructive | Delete specific observations from entities …
- memory:add_observations | call_with: call_tool_write | Add new observations to existing entities …
- memory:read_graph | call_with: call_tool_read | Read the entire knowledge graph
Full descriptions, real call_with advice, no locked/name-only marker. The follow-up call is then refused:
🔒 SECURITY BLOCK: Server 'memory' is currently in quarantine for security review.
Tool calls are blocked to prevent potential Tool Poisoning Attacks (TPAs).
Expected: name-only locked entries with no description or schema, per the design comment above.
Control — the API path is correct. On a second instance, POST /api/v1/servers/everything/quarantine and the same query returns nothing for that server; GET /api/v1/index/search?q=echo → {"results":[],"total":0}.
Control — disable-via-config is correct. Setting "enabled": false in the config file does clear the tools (a disabled server drops out of the active set the orphan sweep uses).
Root cause
The index purge is bolted onto the two API mutation handlers rather than onto the state transition.
Runtime.QuarantineServer(internal/runtime/lifecycle.go:1498) callsindexManager.DeleteServerTools+reindexAffectedProfilesunder an explicit// Security:comment (log line at:1517).Runtime.EnableServerdoes the equivalent for the disable direction.LoadConfiguredServers— the disk-reload path — detects the same transition and ignores it.storedServer.Quarantined != serverCfg.Quarantinedis part ofhasChanged(:1047) and is logged asquarantined_changed: true(:1060), but the only side effect inside that branch is the OAuth-state clear (:1065). No purge.- The orphan sweep (
:1864) only removes servers no longer in config, so a server that is still configured but newly quarantined is never swept. - Discovery itself is fine:
DiscoverToolsalready skips quarantined clients (internal/upstream/manager.go:1134,"Skipping quarantined client for tool discovery"). It just never removes what is already indexed.
Any path that flips Quarantined without going through Runtime.QuarantineServer inherits this. The config-load admission gate re-quarantining a server on reload is the same shape.
Suggested fix
Move the purge onto the transition rather than the caller. In LoadConfiguredServers, where quarantined_changed is already computed, do what QuarantineServer does when the new value is true:
if existsInStorage && !storedServer.Quarantined && serverCfg.Quarantined && r.indexManager != nil {
if err := r.indexManager.DeleteServerTools(serverCfg.Name); err != nil { /* warn */ } else {
r.reindexAffectedProfiles(serverCfg.Name)
}
}Better still, factor the "quarantine took effect" side effects into one helper both paths call, so the next mutation path added cannot miss it.
Defence in depth worth considering separately: the search path currently trusts index membership alone for a security property. A cheap authoritative check on the results — the quarantine state is already loaded for the locked-entry enumeration a few lines below — would make any future index-lag bug a correctness annoyance instead of a disclosure.
Suggested regression test
Assert the property, not the path: for each of {API handler, config-file reload} × {quarantine, disable}, after the transition settles, retrieve_tools must return no description-bearing entry for that server. The existing tests only cover the API path, which is why this went unnoticed.
Not a duplicate
- Security: Quarantined servers' tools are indexed and searchable #218 (Quarantined servers' tools are indexed and searchable) covered newly-added servers being indexed at all.
- /api/v1/index/search bypasses quarantine filtering #877 (
/api/v1/index/searchbypasses quarantine filtering) covered the REST search endpoint lacking a filter.
Both are closed and neither covers the config-file transition leaving an already-built index intact. #877's observation that "quarantine filtering currently lives only in the MCP retrieve_tools handler" is worth re-reading in this light — on the description-bearing branch that filtering is index membership, not a filter.
Found while re-verifying the Web UI UX audit (#1046) against a live core; also recorded there among the defects that are not part of that audit.
Activity
fix(security): also purge when the quarantined server is absent from …
fix: quarantined servers over-report available tools (#1064) + three …
feat(079): "N releases / M weeks behind" upgrade delta (#1081), and f…
fix(security): purge the search index when quarantine arrives via con…
fix: Spec 116 PR1 purges residual index entries on a repeated explici…