Repository navigation
fix(security)!: the plugin lock binds source, binary and secrets; a refused server is never started and offers nothing - #696
Merged
Conversation
… prompts and no connect
… gate note, not a spawn
# Conflicts: # CHANGELOG.md # docs/threat-model.md
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
…d binary, enforce its secret grant
# Conflicts: # docs/threat-model.md
| /// nothing) or revoked. Such a server is not connected at all, so an | ||
| /// unapproved or revoked stdio server never runs. | ||
| pub fn refuse_unseen(&self, server: &str) -> Option<String> { | ||
| match self.lock.get(server) { |
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.
What
Two plugin-lock findings of the #594 audit, now in one PR (see "Why one PR" below).
mcp_read, no/mcp:prompts, no extras probe. An unapproved or revoked server is not even started.secretsare now the server's real launch grant.Why
mcp_read.mcp_readis ReadOnly (no approval) and its result goes into the model context. The host also listed and rendered the server's prompts. A stdio server is code, so starting it already runs it.admitcompared only the server-reported version and tool manifest, which any process can replay. So the same NAME re-pointed at another command or URL, or another binary at the approved path, was trusted. It then got themcpsecrets and every tool argument. The recordedintegrityandsecretswere used by nothing.Why one PR. On the first #680-only head, Cora found, correctly, that
refuse_unseendecided by name only. An approved name pointed at another command was therefore still started, and could replay the manifest. Fixing that before connect is #679's source and binary binding, so #679 is folded in here. The diff is 21 files, +833 / -71.Changes
Admission per session (security(plugins): an unapproved or revoked MCP server still serves resources (mcp_read) and prompts #680).
register_server_toolsrecords the decision on the registry it fills (ToolRegistry::set_mcp_admitted/mcp_admitted).servesession's refusal withdraw another session's resources.mcp_readonly for admitted servers.tole chatlists and renders/mcp:prompts only for admitted servers.Before connect (security(plugins): an unapproved or revoked MCP server still serves resources (mcp_read) and prompts #680, security(plugins): a lock entry is bound to the server name only, not to its source or binary #679).
plugin_gate::Gate::refuse_unseen(server, source)refuses, and the roster skips the server without starting it, when there is:Moved);Rebuilt).Source and binary changes are recorded in the ledger as
source_change/binary_change. A server whose manifest changed is still connected once, to detect it.At connect (security(plugins): a lock entry is bound to the server name only, not to its source or binary #679).
plugin_lock::admit(lock, server, &Live { source, integrity, version, tools })checks source and binary first, then manifest and version.Gate::checktakes the configured source.preflightshows the new states and asks.tole plugin listreports them.Secret grant (security(plugins): a lock entry is bound to the server name only, not to its source or binary #679).
McpServerConfig.secret_grantcomes from the lock entry'ssecrets, which are themcpgrants held at approval.[secrets]release binds it tomcp. It uses the newsubprocess::scrub_env_with_keep.None(an embedder without a lock) keeps today's behaviour.Docs. Threat model (MCP rows),
third-party-plugins-design.md, CHANGELOG: a Security entry (security(plugins): an unapproved or revoked MCP server still serves resources (mcp_read) and prompts #680) and a BREAKING entry with a migration note (security(plugins): a lock entry is bound to the server name only, not to its source or binary #679).Decisions to check
config_sensitivetests used "the unapproved stub was spawned" as their signal. They now check the gate's note, and also that the stub did NOT run.source,integrityandsecretswere recorded at approval by the same functions that compare them now.cargo install cora-code), or whose command line was edited, is refused until it is re-approved once. That means a terminal session, ortole plugin approve <name>.secretsis enforced, not removed. This makes the documented project narrowing true.mcp, at approval time is not passed later until the server is re-approved.npx -y pkg,uvx,docker run): integrity covers the launcher only. The threat model says to pin the package version in the command line; feat(plugins): tole plugin add/list/diff/revoke, description scanner, grants and trust tiers #600 resolves and pins packages.Testing
mcp_admission.rs: a refused server is not admitted; admission is per registry (one admits while another refuses, with no leak); a later refusal withdraws it.plugin_lock::tests::a_lock_entry_is_bound_to_its_source_and_binary(the audit's reproduction):Movedfor another command, a respaced command or a URL;Rebuiltfor another or unreadable binary; revocation wins.mcp_secret_grant.rs(real stdio launch recording its environment): an empty grant passes no secret, a named grant passes it,Nonedefers to the release.plugin_gate::tests::the_gate_binds_the_source_and_the_program_file, using real files and ledger events, then re-approval.plugin_gate::tests::the_secret_grant_is_the_approved_entry.mcp_roster_admission.rs(real roster): a connected but changed server gets nomcp_read; approved as it is, it does.mcp_unapproved_e2e.rs(real binary). A marker-touching stdio "server" is never started when:In
tole chat, a changed server lists no prompts, and/mcp:is refused before rendering.refuse_unseen, or only its source and binary part;admitignoring source and binary;cargo fmt --all --check,cargo clippy --workspace --all-targets --all-features -- -D warnings,cargo test --workspace,cargo test -p tole-core --no-default-features, the no-mcp CI profile, andcora review --no-llm --base origin/develop(no issues).delegate::tests::an_independent_participant_is_a_consult_child_settled_with_its_reportonce under load, andconfig_applyonce on a stale pid-named temp dir.Closes #680
Closes #679