fix(capabilities): client may only narrow the seeded ceiling (audit B1)#89
Merged
Conversation
- initialize now intersects client-declared capabilities with the transport-seeded ceiling instead of replacing it; no seed fails closed to an empty set - policy mode ceiling read from the core (WalletContext.policy_mode): read_only leaves read+preview; unreachable core falls back to the transport ceiling with a warning (MCP-side filtering is advisory, enforcement lives in the core) - SSE: a second initialize can no longer change session capabilities (explicit initialized flag instead of the falsy-set guard) - sign_message: sign_type enum is ["eip191"] only, matching the documented EIP-191-only contract Spec: .claude/specs/2026-07-24-mcp-ceiling-integration.md
Review delta for PR #89: - SSE sessions are now seeded from the same operator ceiling, so the initialize intersection actually bites there too (B1 closed end-to-end; unset env keeps the historical gated-until-granted contract) - ruff format compliance (CI gate was red on tests/test_handlers.py) - test: seeded SSE session narrows client grants, keeps the stored ceiling
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
Second half of closing audit B1 end-to-end (first half: rustok-org/core#96, merged as
eec38c1). The capability ceiling is now authoritative in the core; the MCP layer only reads it and can never widen it.handlers.py):initializenow intersects the client-declared capability list with the transport-seeded ceiling instead of replacing it. An operator launching withRUSTOK_MCP_CAPABILITIES=read_walletgets a session the agent cannot talk out of. No seeded ceiling fails closed to an empty set — the server seeds, the client only narrows.initializereadspolicy_modevia WalletContext (core increment 1).read_onlyleaves read+preview tools;supervised/autonomouskeep the full set while the core itself parks/denies writes. Unreachable core → transport ceiling alone with a warning — MCP-side filtering is advisory; enforcement stays in the core (no policy enforcement duplicated in this layer).initializedexplicitly.sign_messageschema matches its contract:sign_typeenum is["eip191"](it listedeip712while the description said EIP-712 is not supported).Spec:
.claude/specs/2026-07-24-mcp-ceiling-integration.mdTest plan
pytest— 195 passedruff check .— clean{read_wallet}+ client asks all →{read_wallet}; no seed → empty set (fail-closed)read_onlymode: tools/list hides execute/sign, keeps read+preview;supervisedkeeps the full setsign_typeenum ==["eip191"]