Skip to content

fix(security)!: the plugin lock binds source, binary and secrets; a refused server is never started and offers nothing - #696

Merged
ajianaz merged 7 commits into
developfrom
security/refused-mcp-no-extras
Nov 13, 2026
Merged

ajianaz merged 7 commits into
developfrom
security/refused-mcp-no-extras

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

What

Two plugin-lock findings of the #594 audit, now in one PR (see "Why one PR" below).

Why

Why one PR. On the first #680-only head, Cora found, correctly, that refuse_unseen decided 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

Decisions to check

  • Unapproved servers are no longer started, and neither are moved or rebuilt ones. The refusal notes name the server and the remedy.
    • Two config_sensitive tests used "the unapproved stub was spawned" as their signal. They now check the gate's note, and also that the stub did NOT run.
  • Existing version 2 locks need no migration.
    • source, integrity and secrets were recorded at approval by the same functions that compare them now.
    • A server whose binary was upgraded since approval (cargo install cora-code), or whose command line was edited, is refused until it is re-approved once. That means a terminal session, or tole plugin approve <name>.
  • secrets is enforced, not removed. This makes the documented project narrowing true.
    • Side effect: a secret not held, or not bound to mcp, at approval time is not passed later until the server is re-approved.
  • Launcher sources (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.
  • Prompts and resource templates stay outside the manifest hash. They are reachable only from an admitted server. This is documented.

Testing

  • Core:
    • 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): Moved for another command, a respaced command or a URL; Rebuilt for 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, None defers to the release.
  • CLI:
    • 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 no mcp_read; approved as it is, it does.

    • mcp_unapproved_e2e.rs (real binary). A marker-touching stdio "server" is never started when:

      • it has no lock entry;
      • it is revoked;
      • an approved name points at another command;
      • another binary sits at the approved path.

      In tole chat, a changed server lists no prompts, and /mcp: is refused before rendering.

  • Mutation checks, each failing as expected:
    • skipping refuse_unseen, or only its source and binary part;
    • the roster ignoring admission;
    • never recording admission;
    • chat ignoring admission;
    • admit ignoring source and binary;
    • the launcher ignoring the grant.
  • Gates on the head: 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, and cora review --no-llm --base origin/develop (no issues).
  • Local flakes, unrelated to this PR, both passing on rerun: delegate::tests::an_independent_participant_is_a_consult_child_settled_with_its_report once under load, and config_apply once on a stale pid-named temp dir.

Closes #680
Closes #679

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

Comment thread crates/tole-core/src/mcp.rs Fixed
Comment thread crates/tole-cli/src/plugin_gate.rs Outdated
/// 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) {
@ajianaz ajianaz changed the title fix(security): a server the plugin lock refuses gets no resources, no prompts and no connect fix(security)!: the plugin lock binds source, binary and secrets; a refused server is never started and offers nothing Nov 13, 2026
@ajianaz
ajianaz merged commit dc7fa46 into develop Nov 13, 2026
19 checks passed
@ajianaz
ajianaz deleted the security/refused-mcp-no-extras branch November 20, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants