fix(mcp): fail closed on Untrusted trust level with no tool_allowlist#6505
Merged
Conversation
bug-ops
enabled auto-merge (squash)
July 19, 2026 18:41
apply_allowlist() exposed all tools for the default Untrusted trust level when tool_allowlist was unset, logging only a warning. Sandboxed already failed closed in the same situation, and the ACP bridge hardcodes Untrusted+None for every IDE-requested server, defeating its own sandboxing claim. Untrusted+None now returns zero tools by default, matching Sandboxed. A new per-server allow_untrusted_without_allowlist flag (default false) preserves the previous expose-all behavior for operators who opt in explicitly. The unmatched-trust-level catch-all also now fails closed instead of exposing all tools, closing a latent gap where a future non_exhaustive McpTrustLevel variant would silently expose everything. expected_tools attestation no longer substitutes as an implicit allowlist: an Untrusted server with expected_tools set but no tool_allowlist and the opt-in flag unset now exposes zero tools. Also removes a stale doc comment, TODO, and dead clippy allow left above IngestConfig after ingest_tools moved to its own module. Closes #6474 Closes #6477
bug-ops
force-pushed
the
fix/6474-mcp-untrusted-allowlist-fail-open
branch
from
July 19, 2026 18:41
8f1607a to
498e8c4
Compare
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
apply_allowlist()fail-opened the defaultUntrustedMCP trust level whentool_allowlistwas unset, exposing every tool with only awarn!log — including for every IDE-requested server via the ACP bridge, which hardcodes exactly this configuration.Untrusted+ no allowlist now fails closed (zero tools) by default, matchingSandboxed. A new per-server opt-in flagallow_untrusted_without_allowlist(defaultfalse) restores the previous expose-all behavior for operators who want it explicitly.#[non_exhaustive]McpTrustLevelvariants.expected_toolsattestation no longer acts as an implicit allowlist substitute — this is a documented behavior change (see CHANGELOG).TODO, and dead#[allow(...)]block orphaned aboveIngestConfigafteringest_toolsmoved to its own module.Closes #6474
Closes #6477
Test plan
cargo +nightly fmt --checkcargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warningscargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins— 14612 passed, 35 skipped, 0 failedRUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler"gitleaks protect --stagedclean