Skip to content

[MCP contract security 2/2] Verify and sign MCP trust baselines - #804

Open
salmonumbrella wants to merge 10 commits into
runkids:mainfrom
salmonumbrella:feat/mcp-signed-baselines
Open

salmonumbrella wants to merge 10 commits into
runkids:mainfrom
salmonumbrella:feat/mcp-signed-baselines

Conversation

@salmonumbrella

@salmonumbrella salmonumbrella commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Stacks on #803

Type

  • Bug fix
  • Small improvement (docs, typo, minor refactor)
  • Feature proposal (proposals/ only)
  • Approved feature or large change — maintainer approval remains pending

Linked Issue

Refs #789 and design note #802. Merge order: contract review first, signing second. This PR's own commit is a642eef544fb2fb49126cac282b4d50165d46c07; its parent is 47646362cfebcb4073a631b47341bb57871ed5d1. The upstream-main diff also includes the unmerged first slice.

What changed

  • Add optional Ed25519 verification and signing to the existing atomic MCP baseline store. The verifier comes from an explicit external public-key file.
  • Require explicit unsigned migration review. Approve only the selected inventory and downgrade all unselected records to legacy evidence before signing the store.
  • Bind review tokens to the verification anchor and complete migration proposal; verify the same loaded bytes again under the existing lock. Signed-store failures remain failures even with an empty selection.
  • Document the signing state table and ephemeral-key runbook. Add key/integrity/CLI/property regressions and localize all six signed-store refusal messages across all 11 dashboard locales; the Persian refusal regression checks rendered guidance without weakening control-character escaping.

Why

Contract hashes can explain drift, but an attacker who can rewrite unsigned state can also recompute its hashes. An independently trusted public key lets operators detect altered baseline contents without treating a key committed beside the state as a trust anchor.

Usage

With an existing Ed25519 PKIX public key and matching PKCS8 private key:

skillshare mcp check example --live --verify-key /path/to/public.pem --json
# Inspect the complete inventory and revision before approving:
skillshare mcp check example --live --accept-tools --revision <reviewed-revision> \
  --verify-key /path/to/public.pem --signing-key /path/to/private.pem

For an existing unsigned store, add --sign-unsigned to both the explicit preview and acceptance. That migration signs the selected approved record and preserves every other record as legacy-unsigned evidence requiring its own review. A missing store does not need migration. A signed store needs --verify-key on every live check, and a matching signer on every acceptance, including a no-op.

The first slice's conservative recognized-credential overlap rules still apply, including short resolved values; signing does not bypass them.

The dashboard has no key inputs and cannot approve signed stores. It reports that CLI verification is required. Keys are never created automatically, saved to MCP configuration or included in probe arguments, reports or logs. Private key files require safe Unix mode bits; Windows ACL validation is not implemented.

Threat model and limits

Verification authenticates the complete saved payload, including other scopes and retained legacy evidence. It does not attest the MCP implementation, mediate calls, protect a compromised external key, or detect rollback to an older valid signed store. Removing a signature and omitting the external verification requirement can look like unsigned state; the trusted verifier must remain outside attacker-writable state and be supplied on protected checks.

Signing uses a domain-separated native envelope, not PIN-SPEC signature interoperability. Independently authored standard-library Go, with RugSnare (Apache-2.0) as the primary design reference and Tirith (AGPL-3.0) for concepts only. No source, translated code, fixtures or golden vectors from either project are copied.

Verification

Ready for review at a642eef544fb2fb49126cac282b4d50165d46c07, rebased onto #803 head 47646362cfebcb4073a631b47341bb57871ed5d1. This now includes dbcc5726, which checks numeric JSON credential leaves in both contract and connection-identity walks, plus the later #803 safety fixes. The signing delta is preserved; the sole rebase conflict kept the base's consolidated CLI fixtures and the signing flag tests.

git diff --check and python3 scripts/ai-context.py check passed. Independent Terra and Sonnet five-pass source reviews cleared the signing integration without confirmed findings. Exact-head Nix run 43156835137, unit/race, Windows, Ubuntu integration and redteam stages in Test run 43156835136 passed. Both numeric regressions passed. macOS integration and Docker-offline also passed; every executed check is green. Docker-online and redteam-signal are workflow skips. No roborev-ci workflow/check is currently exposed.

No local tests/builds, Docker, real signing runbook, property suite, frontend tooling or website build were run during this feedback pass. CI is the runtime gate. Maintainer feature approval remains pending.

Checklist

  • I've read CONTRIBUTING.md, including its AI-assisted contributions section
  • I've reviewed every line of the diff and can explain it — independent Terra and Sonnet source reviews cleared the signing integration
  • Tests included and passing (make check) — equivalent context, Herdr, formatting, vet, unit/race and Ubuntu integration CI stages passed on a642eef5; all executed checks are green
  • No unrelated changes in the diff
  • Scope is focused — optional integrity over the first slice's baseline transaction

@salmonumbrella
salmonumbrella marked this pull request as ready for review November 8, 2026 21:53
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-13T00:43:44.850882Z
We couldn’t complete this review. Comment @codex review to try again.
a642eef Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6b46e28129

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/mcp/check_contract.go Resolved
@salmonumbrella
salmonumbrella marked this pull request as draft November 9, 2026 13:52
@salmonumbrella
salmonumbrella force-pushed the feat/mcp-signed-baselines branch from 6b46e28 to 59b05f2 Compare November 9, 2026 15:25
@salmonumbrella

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 59b05f2bd9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@salmonumbrella
salmonumbrella marked this pull request as ready for review November 10, 2026 10:41
Extend existing tool pinning with complete bounded snapshots, conservative
contract differences and credential-safe descriptor audits. Bind approval to
the reviewed inventory, connection identity, scope and current source/store.

Share explicit revision-bound acceptance across CLI and local dashboard API,
harden discovery transports and preserve full exact-number review text.
Document threat boundaries and independently authored prior-art provenance.

Tests are authored but unrun: required local devcontainer is unavailable.
Remote CI and review must verify compilation and runtime behavior.
Preserve credential-free project root identifiers exactly so dashboard checks associate the right project and approvals submit the selected scope. Continue redacting credential-bearing roots after refusing their review, and escape controls at presentation boundaries.

The rebased feature already rejects numeric credential lexemes in both contract and live checks and excludes disabled project entries from strict observation failures; their regression coverage remains in the feature commit.
Remove unreachable and duplicated scenarios, retain unique credential and scope checks, and use valid server fixtures. Exercise real control runes in JSON output and consolidate dashboard refusal and localization cases.
Combine remaining scope, persistence, status and contract cases into shared tables while preserving distinct behavior checks and reachable fixtures.
Resolve the stdio working directory before launch and bind that same path into the review identity, so retargeted symlinks cannot reuse approval. Reject unresolved directories before starting a server.

Parse HTTP media types to handle case and parameters in event streams and discovery errors. Exercise both cases and remove the disclaimer-only UI test.
Describe the complete contract snapshots stored in tool-pins.json and warn that their text may be sensitive. Keep the existing translated file maps consistent.
Fingerprint the explicit transport, credential references, tool policy and native options without target selection or disabled state. Client selection changes can then retain an unchanged contract approval.
Keep the live review, explicit revision approval and fresh unchanged check as the CLI integration boundary while leaving detailed drift and logging coverage to their owning tests.
Remove the unsupported disabled entry with an active connection while retaining identity and approval coverage for valid target changes.
Authenticate the complete atomic MCP baseline envelope with an external
Ed25519 verifier. Require explicit unsigned migration, bind the full proposal
and public anchor to review, and preserve every unselected record as legacy
evidence. Keep byte-stable verified no-ops under the existing lock and CAS.

Add independently authored standard-library regression/property fixtures with
ephemeral keys. Translate all six signing refusal messages in every dashboard
locale and cover the Persian signed-store refusal without changing
sanitization of untrusted text.

Runtime tests, builds and full gates were not run locally because the required
devcontainer is unavailable; remote CI remains the runtime gate.
@salmonumbrella
salmonumbrella force-pushed the feat/mcp-signed-baselines branch from 59b05f2 to a642eef Compare November 12, 2026 04:45
@salmonumbrella

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@runkids runkids added feature New feature or request pending mcp MCP server and MCP configuration security Supply-chain and malicious-skill detection labels Nov 15, 2026
@runkids

runkids commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Thanks for all the work you've put into these. A lot of large PRs have arrived at once, more than I can take in right now, so I need to go through them slowly. I can't promise a date, but I'll get to them.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request mcp MCP server and MCP configuration pending security Supply-chain and malicious-skill detection

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants