fix(security): block MCP tools for quarantined skills (#1876)#1892
Merged
fix(security): block MCP tools for quarantined skills (#1876)#1892
Conversation
Add two-layer enforcement to TrustGateExecutor so that Quarantined skills
cannot use MCP tools to bypass QUARANTINE_DENIED restrictions:
1. is_quarantine_denied() — exact match + _{entry} suffix match against the
static QUARANTINE_DENIED list (defence-in-depth for MCP-wrapped natives)
2. mcp_tool_ids registry — Arc<RwLock<HashSet<String>>> populated at startup
with all registered MCP tool sanitized IDs; Quarantined skills are denied
access to any tool in this set regardless of its name
Both check_trust() and execute_tool_call_confirmed() enforce the combined
predicate: is_quarantine_denied(id) || self.is_mcp_tool(id).
runner.rs populates the registry after MCP servers connect, covering tools
like filesystem_write_file, shell_execute, and docker_container_exec that
had no suffix match in QUARANTINE_DENIED.
Closes #1876
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
QUARANTINE_DENIEDinTrustGateExecutoronly matched native tool IDs; MCP tools with server-prefixed IDs (e.g.filesystem_write_file,shell_execute,docker_container_exec) bypassed all quarantine restrictionsmcp_tool_ids: Arc<RwLock<HashSet<String>>>registry toTrustGateExecutor— populated at startup with all registered MCP tool sanitized IDsis_quarantine_denied()with exact + suffix matching as defence-in-depth for MCP-wrapped native tool namescheck_trust()andexecute_tool_call_confirmed()now enforce:is_quarantine_denied(id) || self.is_mcp_tool(id)runner.rspopulates the registry after MCP servers connectTest plan
cargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --binsgithub_run_command,shell_execute,docker_container_execare blocked for Quarantined skillsfilesystem_write_fileblocked via registry even though it has no suffix matchread,filesystem_read_file) remain allowed for Quarantined skillscargo +nightly fmt --checkcleancargo clippy --workspace --features full -- -D warningscleanCloses #1876