refactor(mcp): replace bool parameters with type-safe enums in McpClient connect paths#6614
Merged
Merged
Conversation
…ient connect paths McpClient::connect took two adjacent positional bools (suppress_stderr, env_isolation); connect_url/connect_url_with_headers/connect_url_oauth took a bare trusted bool downgraded from McpTrustLevel at the call site. Both shapes let a future signature edit silently swap security-relevant behavior (full parent-env inheritance, SSRF private-IP bypass) without a compiler error. Replace the two connect() bools with StderrPolicy and EnvPolicy enums, and pass McpTrustLevel through connect_url* directly instead of collapsing it to bool beforehand. No runtime behavior change. BREAKING CHANGE: McpClient::connect now takes StderrPolicy/EnvPolicy instead of two bools; connect_url/connect_url_with_headers/connect_url_oauth now take McpTrustLevel instead of trusted: bool. Closes #6478
bug-ops
force-pushed
the
fix/6478-mcp-bool-param-order-swap
branch
from
July 20, 2026 21:28
cb5ed26 to
3817075
Compare
bug-ops
enabled auto-merge (squash)
July 20, 2026 21:28
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
McpClient::connecttook two adjacent positionalboolparameters (suppress_stderr,env_isolation). Replaced withStderrPolicy(Forward/Suppress) andEnvPolicy(InheritAll/Isolated) so a future signature edit can no longer silently swap stderr verbosity with the parent-environment-inheritance control.connect_url/connect_url_with_headers/connect_url_oauthtook a baretrusted: bool, downgraded fromMcpTrustLevelat the only call site. They now takeMcpTrustLeveldirectly and match on it internally, so the SSRF private-IP bypass check is gated by the enum instead of a bool that discarded which variant it came from.zeph-mcp's public API; documented inCHANGELOG.md.Closes #6478
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 -p zeph-mcp --features "mock,profiling"— 563 passed, 0 failed (561 pre-existing + 2 new)RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --all-features -p zeph-mcpcleancargo test --doc -p zeph-mcp— all doctests pass, including the two new ones onStderrPolicy/EnvPolicyconnect_url_untrusted_blocks_private_ip/connect_url_trusted_skips_ssrf_check— exerciseMcpTrustLevelat the actual changed publicconnect_urlsignature (SSRF check runs before any I/O, so no real MCP server needed)gitleaks protect --staged— no leaks