# Which invariants prevent MCP tool-manifest attestation from silently degrading across transitive server upgrades **Date of Record:** 2026 November 24 **Scope:** Applies to agent runtimes that gate MCP tool invocation on signed tool manifests and SBOM-style provenance chains, where a server's advertised toolset is composed from upstream MCP servers or vendored tool packs. Does not apply to single-binary MCP servers with no transitive tool provenance, nor to runtimes that re-attest on every invocation rather than caching attestation state. ## Core Distinction A signed tool manifest attests *a specific artifact at a specific digest*. It does not attest *the behavior of the tool as the agent will invoke it*. The failure boundary is the gap between manifest-level integrity (the bytes of the manifest verify against the signer's key) and *composition-level integrity* (the tool the agent actually calls is the tool the manifest described, after transitive resolution, schema merging, and description rewriting by an upstream server). The non-obvious part: signature verification passes. The SBOM hashes match. The provenance chain is unbroken. And the agent still invokes a tool whose `inputSchema`, `description`, or default parameters were substituted by an intermediate server that legitimately re-signs the composed manifest with *its own* key. Attestation is transitive but *trust is not*: the leaf signer vouches for what it shipped, not for what it forwarded. An agent that treats "manifest signature valid" as "tool semantics match the reviewed baseline" has silently widened its trust root to every server in the resolution path. ## What Was Observed A three-tier MCP topology: a *leaf* tool server (`pdf-extract` v2.3.1, signer `leaf@vendor`), an *aggregator* server (`doc-toolkit` v1.8.0, signer `aggregator@platform`) that re-exports leaf tools under a unified namespace, and the agent runtime that consumes `doc-toolkit`'s manifest. The reviewed baseline manifest for `doc-toolkit` pinned `pdf-extract.extract_text` with `inputSchema.properties.path.pattern = "^/sandbox/.*"` — a path confinement the agent's policy engine relied on to bound filesystem reads. The aggregator's manifest carried a valid signature from `aggregator@platform`, and its SBOM listed `pdf-extract@sha256:9f3c…` as a dependency with a matching digest. Every check the runtime performed passed. The failure trace: 1. `pdf-extract` v2.3.1 was upgraded to v2.3.2 upstream. The patch changed only an internal regex; the tool's own manifest signature and the `path` pattern were unchanged. The leaf's SBOM digest rotated to `sha256:4a71…`. 2. The aggregator, on cold start, re-resolved its dependency, pulled v2.3.2, and — because it *composes* schemas by merging leaf properties with its own defaults — regenerated its manifest. During regeneration it dropped the `path.pattern` constraint: the aggregator's merge routine only carried forward properties it recognized, and `pattern` was not in its allowlist of mergeable JSON Schema keywords. 3. The aggregator signed the new manifest with `aggregator@platform`. Signature valid. Provenance chain: `aggregator@platform` → `pdf-extract@sha256:4a71…`, digest matched the actually-installed leaf. SBOM consistent. 4. The agent runtime's cache key was `(server_name, manifest_signature)`. The signature changed (new manifest bytes), so the cache invalidated and the runtime re-attested — and *accepted*, because the only invariant checked was "signature verifies against a key in the trust store," and `aggregator@platform` was trusted. 5. The agent invoked `extract_text` with `path="/etc/passwd"`. No `pattern` in the schema, no policy-engine rejection, tool executed. The confinement invariant was lost not to a forgery but to a *legitimate re-signing of a lossy composition*. The signature attested the aggregator's honest output; the aggregator's output was honestly wrong. ## Condition of Validity The invariant "a valid manifest signature implies the tool matches the reviewed baseline" holds **only if** the following jointly hold: - **Schema stability across composition.** Every keyword in the reviewed `inputSchema` survives the aggregator's merge routine byte-for-byte, or the merge is provably a superset-preserving operation. This fails for any merge that allowlists keywords, because JSON Schema is open-ended and the allowlist is always incomplete relative to what a policy engine may depend on (`pattern`, `format`, `const`, `dependentRequired`, `unevaluatedProperties`). - **Signer identity equals review identity.** The key that signed the *currently served* manifest is the same key under which the baseline was reviewed. When an aggregator re-signs, the signer changes even though the tool did not — so a trust store that accepts "any trusted key" conflates two distinct principals. - **Transitive digest pinning is *behavioral*, not just bytes.** The SBOM digest pins the leaf artifact's bytes, but the agent's contract is with the *composed* tool. A digest match on the leaf says nothing about the aggregator's transformation of the leaf's schema. When any of these is violated, the attestation is *structurally valid and semantically void*. The runtime cannot detect the violation from the signature alone; it requires a separate invariant comparing served semantics to reviewed semantics. ## Decision Boundary The operative decision is **what the runtime compares on cache miss and re-attestation**. Two boundaries: *Boundary A — attestation scope.* If the runtime attests only `(manifest_signature ∈ trusted_keys)`, it is exposed to lossy composition. If it attests `(manifest_signature ∈ trusted_keys) ∧ (served_inputSchema ⊇ reviewed_inputSchema) ∧ (served signer ∈ reviewed_signer_set)`, the aggregator re-sign in the trace above is rejected at step 4 — not because the signature is bad, but because the *served schema is a strict subset* of the reviewed schema (the `pattern` constraint vanished) and the *signer differs* from the reviewed leaf signer. *Boundary B — trust-root widening.* If the trust store is a flat set of keys, adding an aggregator implicitly trusts it to speak for every leaf it composes. The correct boundary is a *scoped* trust store: `aggregator@platform` is authorized to sign manifests for `doc-toolkit`'s own tools and to *forward* leaf tools only with the leaf's original signature intact (pass-through, not re-sign). Re-signing across a composition boundary must require an explicit, reviewed delegation record; absent it, the runtime treats the composed tool as unattested and refuses invocation. The decision rule: **a signature is necessary but not sufficient; the sufficient condition is signature validity conjoined with a monotonic-superset check of served-vs-reviewed schema and an exact-match check of signer identity against the reviewed principal.** Schema subsetting is the tell — a legitimate upgrade may *add* constraints or fields, but a *removed* constraint on a security-relevant keyword (`pattern`, `format`, `maximum`, `enum`) is a semantic downgrade that must fail closed. ## Operational Effect Enforcing the conjoined invariant changes runtime behavior in three concrete ways: - **False-positive rejections on benign upgrades.** A leaf that legitimately relaxes `pattern` (e.g., widening a path prefix) now fails re-attestation and requires a reviewed baseline bump. This is the intended cost: the runtime trades availability for the guarantee that confinement constraints cannot be silently dropped. Operators must budget for baseline re-review on any schema-relaxing upgrade. - **Aggregator re-signs become visible events.** Because signer identity is checked against the reviewed principal, every composition that re-signs (rather than passes through) surfaces as an attestation mismatch, forcing the delegation record to exist. Aggregators that previously "just worked" now require explicit delegation configuration. - **Cache keys must include schema hash, not just signature.** The trace's step 4 re-attested because the signature changed; under the conjoined invariant the cache key becomes `(server, signer, sha256(canonical(served_schema)))`, so a signature-preserving schema mutation (possible if an aggregator re-signs deterministically) still invalidates and re-checks. The residual exposure: an aggregator that both re-signs *and* preserves the schema byte-for-byte, under a delegation record the operator approved, can still ship a malicious *implementation* behind an unchanged interface. That is out of scope for manifest attestation — it is the province of runtime sandboxing and behavioral monitoring. Manifest attestation bounds *what the tool claims to accept*, not *what it does with the input*. ```python import hashlib import json from dataclasses import dataclass class AttestationInvariantError(RuntimeError): """Raised when a served MCP tool manifest is structurally valid but semantically diverges from the reviewed baseline in a way that widens the agent's trust root or drops a security-relevant schema constraint.""" SECURITY_RELEVANT_KEYWORDS = frozenset( {"pattern", "format", "maximum", "minimum", "enum", "const", "maxLength", "minLength", "dependentRequired"} ) @dataclass(frozen=True) class ReviewedBaseline: server: str tool: str signer: str input_schema: dict @dataclass(frozen=True) class ServedManifest: server: str tool: str signer: str input_schema: dict signature_valid: bool leaf_digest: str def _canonical(obj: dict) -> str: return json.dumps(obj, sort_keys=True, separators=(",", ":")) def _schema_hash(schema: dict) -> str: return hashlib.sha256(_canonical(schema).encode()).hexdigest() def _dropped_security_keywords(reviewed: dict, served: dict) -> set[str]: """Return security-relevant keywords present in reviewed but absent in served.""" dropped: set[str] = set() for kw in SECURITY_RELEVANT_KEYWORDS: if kw in reviewed and kw not in served: dropped.add(kw) for key in ("properties",): r_props = reviewed.get(key, {}) s_props = served.get(key, {}) for prop_name, r_spec in r_props.items(): s_spec = s_props.get(prop_name, {}) for kw in SECURITY_RELEVANT_KEYWORDS: if kw in r_spec and kw not in s_spec: dropped.add(f"{prop_name}.{kw}") return dropped def attest_served_manifest( baseline: ReviewedBaseline, served: ServedManifest, trusted_keys: frozenset[str], ) -> str: """Return the cache key on success; raise on any invariant violation. The conjoined invariant: 1. signature verifies against a trusted key, 2. served signer matches the reviewed signer (no trust-root widening), 3. no security-relevant schema keyword was dropped (no lossy composition). """ if not served.signature_valid: raise AttestationInvariantError( f"manifest signature invalid for {served.server}/{served.tool}" ) if served.signer not in trusted_keys: raise AttestationInvariantError( f"signer {served.signer!r} not in trust store" ) if served.signer != baseline.signer: raise AttestationInvariantError( f"signer divergence for {served.server}/{served.tool}: " f"reviewed={baseline.signer!r} served={served.signer!r}; " f"composition re-signed across a trust boundary without a " f"delegation record — refusing invocation" ) dropped = _dropped_security_keywords(baseline.input_schema, served.input_schema) if dropped: raise AttestationInvariantError( f"lossy composition for {served.server}/{served.tool}: " f"security-relevant keywords dropped {sorted(dropped)}; " f"reviewed_schema={_schema_hash(baseline.input_schema)} " f"served_schema={_schema_hash(served.input_schema)}" ) return ( f"{served.server}/{served.tool}" f"@{served.signer}" f"#{_schema_hash(served.input_schema)}" ) ```