fix(mcp): lock tool_list for OAuth-transport MCP connections - #6138
Merged
Conversation
bug-ops
force-pushed
the
fix/6118-mcp-oauth-tool-list-lock
branch
from
July 12, 2026 14:56
210d77f to
24cc006
Compare
bug-ops
enabled auto-merge (squash)
July 12, 2026 14:56
spawn_oauth_connections never inserted the connecting server's ID into tool_list_locked, so the lock_tool_list hardening option silently exempted OAuth-transport servers from post-attestation tool-injection protection while stdio/HTTP/SSE servers were correctly covered. Insert the lock before the OAuth handshake starts, mirroring the non-OAuth path, and remove it on handshake failure in process_oauth_results so a failed connection is not left permanently locked. Adds first-ever test coverage for the lock_tool_list/ tool_list_locked invariant. Closes #6118
bug-ops
force-pushed
the
fix/6118-mcp-oauth-tool-list-lock
branch
from
July 12, 2026 15:05
24cc006 to
b4694b3
Compare
5 tasks
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
spawn_oauth_connectionsnever inserted the connecting server's ID intotool_list_locked, so thelock_tool_listhardening option silently exempted OAuth-transport MCP servers from post-attestation tool-injection protection, while stdio/HTTP/SSE servers were correctly covered.process_oauth_resultsso a failed connection isn't left permanently locked.lock_tool_list/tool_list_lockedinvariant (4 new tests).Closes #6118
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(13079 passed, 0 failed)RUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace ...)cargo test -p zeph-mcp --lib manager::testsre-verified after rebase onto latest main (95 passed, 0 failed)remove_server/shutdown_all_shared/handle_connect_resultprobe-block — candidate for a separate P3 follow-up, not part of this fix).local/testing/playbooks/mcp.mdand.local/testing/coverage-status.mdupdated in the main repo per project convention