Skip to main content

Module trust

Module trust 

Source
Expand description

The trust gate over the project tier (#5428).

Why: <project>/.trusty-code/mcp.toml is REPO-TRACKED content. Honouring an arbitrary command from it means anyone who can land a commit — or anyone whose repo you clone — chooses a subprocess this harness spawns with the operator’s ambient credentials. That is remote code execution, and it is the same vector trusty_agents::mcp::shared::merge_mcp_json gates .mcp.json behind (#3266).

What: the project tier may say WHICH of the operator’s globally configured servers this project uses, never WHAT a server runs. A Disable always passes — switching a connector off can only reduce what runs. A Set passes only when it is content-equivalent to a global entry of the same name. “Content-equivalent” is exactly transport_equivalent: the identical command, args and env for stdio, the identical url and headers for a remote entry. Name-only matching is NOT sufficient; that would let a project keep a trusted name and swap the command behind it, which is the whole attack. Anything else is refused as an McpIssue whose remedy names the global file — the operator’s own file, which they alone write.

An accepted Set contributes exactly TWO things: its name (which matched) and its enabled flag. transport is byte-identical by construction, and extensions is DISCARDED and replaced with the global entry’s — see gate. extensions is an uninterpreted serde_json map every consumer reads its own semantics out of (trusty-agents reads auth, scopes and discover from it), so letting a repo-tracked file write it would hand that file a second, unchecked channel into consumer behaviour — the same trust boundary the transport comparison draws, walked around.

// #5428: trust-by-content per the #7422/#3033 ruling.

Test: super::tests::trust_tests — the whole module.

Functions§

gate
Split the project’s table into overrides the resolver may see and refusals.
transport_equivalent
Whether two transports describe the SAME connection, byte for byte.