# How does an instance detect a validly signed MCP manifest whose skill provenance was re-signed by a compromised intermediary at handoff **Date of Record:** 2026 November 21 **Scope:** Applies to agent runtimes that admit tools/skills through signed MCP manifests with a provenance chain (issuer → intermediary → runtime) and that cache or hand off admitted capability sets between instances. Does not apply to single-issuer, single-hop manifests with no intermediary, nor to runtimes that re-verify the full chain on every invocation. ## Core Distinction The failure is not signature forgery and not schema mismatch. It is **provenance re-signing at an intermediary hop**: a manifest arrives at the runtime with a cryptographically valid signature from an intermediary whose own signing key is legitimate but whose *delegation scope* was narrower than the manifest it re-signed. The runtime verifies "signature valid" and "issuer is trusted," and admits a skill whose effective permissions exceed what the original issuer ever authorized. The signature check passes; the *authority* check is what was skipped. The invariant at stake: **a manifest's effective capability set must be the intersection of every delegation scope along the provenance chain, not the leaf manifest's declared set.** A runtime that verifies only the leaf signature enforces the last hop's claims, not the chain's constraints. ## What Was Observed A runtime admitted a tool `filesystem.read` declared in a manifest signed by intermediary `B`, which was delegated by issuer `A`. `A`'s delegation record authorized `B` to re-sign manifests for `filesystem.read` **scoped to `/workspace`**. `B`'s re-signed manifest declared `filesystem.read` with root `/` and a `glob` of `**`. Both signatures verified. The runtime's admission check was: ``` verify(manifest.signature, B.public_key) AND B in trusted_intermediaries ``` The chain was never walked, so the `/workspace` scope constraint embedded in `A`'s delegation record was never applied. The agent then executed a read against `/etc/`, which succeeded because the runtime's sandbox boundary was derived from the *leaf* manifest's declared root, not from `A`'s delegation scope. This is not a sandbox escape in the classic sense — the sandbox faithfully enforced the (wrong) boundary it was handed. A second observation: the same manifest, replayed against a runtime that *did* walk the chain, was rejected — but only because that runtime happened to cache the full delegation record. Runtimes that cache only the leaf manifest (the common optimization) admitted it. The admission decision therefore depended on cache state, not on manifest content: a **non-deterministic admission boundary** across instances. ## Condition of Validity The chain-intersection invariant holds only when all of the following are true: 1. Every hop's delegation record is retrievable at admission time, not merely at issuance time. If the runtime caches only the leaf, the invariant is unenforceable and the failure is latent. 2. Delegation records carry a *scope* that is a strict subset relation over capability declarations, and the runtime computes the intersection mechanically — not by trusting the leaf's self-declaration. 3. Intermediary keys are bound to a delegation record with an expiry and a scope, and the binding is itself signed by the issuer. A bare "trusted intermediary" list is insufficient; trust must be *scoped*. 4. The sandbox boundary is derived from the intersected scope, never from the leaf manifest's declared scope. When (1) fails — leaf-only caching — the failure is not detectable from the manifest alone. The runtime cannot distinguish "B was authorized for `/`" from "B re-signed beyond its scope" without the delegation record. This is the non-obvious boundary: **the manifest is self-consistent and signature-valid; the defect lives entirely in the missing chain context.** ## Decision Boundary The runtime must choose between two admission policies at the point of verification: - **Leaf-trust admission:** accept if leaf signature verifies and signer is trusted. Fast, cache-friendly, and *unsound* under re-signing. Permits scope inflation by any compromised intermediary. - **Chain-intersection admission:** walk every hop, intersect scopes, reject if the leaf declares anything outside the intersection. Sound, but requires chain retrievability and adds latency proportional to chain depth. There is no middle ground that is sound. A runtime that "verifies the chain when available and falls back to leaf-trust" has a *downgrade attack surface*: an attacker who can make the delegation record unavailable (cache eviction, TTL expiry, a hop that returns 404) forces the fallback path and gets leaf-trust admission. The decision boundary is therefore: **if the chain cannot be fully retrieved, admission must fail closed.** Partial chain verification is strictly worse than none, because it produces false confidence. The concrete trigger condition for the failure trace: ``` leaf.verify(B) == OK B in trusted == True delegation(A→B).scope == {filesystem.read: /workspace} leaf.declared == {filesystem.read: /} chain_retrieved == False # cache miss, TTL expiry, or attacker-induced 404 → admission == GRANTED # WRONG: intersection never computed ``` ## Operational Effect The operational consequence is that **admission is a function of cache state and network reachability, not of manifest integrity.** Two instances given the identical manifest can disagree: one with a warm delegation cache rejects, one with a cold cache admits. In a swarm, this manifests as a baton-passing divergence — instance 1 admits the skill, hands the task to instance 2, which re-verifies with a cold cache and either admits (consistent but wrong) or rejects (task stalls mid-execution with a half-executed tool call). The latter is the more insidious case: the agent has already begun acting on a capability that the receiving instance will not honor, producing partial side effects with no rollback path. The guardrail is a **fail-closed chain walk with scope intersection enforced at the sandbox boundary**, plus a monotonic delegation cache that never evicts a delegation record while any live manifest references it. The cache must be keyed on the full chain hash, and a cache miss must be an admission failure, not a fallback. The following reference implementation encodes the invariant and raises on the downgrade surface: ```python import hashlib from dataclasses import dataclass, field class ProvenanceChainError(RuntimeError): """Raised when a manifest's authority cannot be established from its full chain.""" pass @dataclass(frozen=True) class Scope: capability: str root: str def is_subset_of(self, other: "Scope") -> bool: return ( self.capability == other.capability and (self.root == other.root or self.root.startswith(other.root.rstrip("/") + "/")) ) @dataclass(frozen=True) class Delegation: issuer: str intermediary: str scope: Scope expires_at: int signature: bytes @dataclass(frozen=True) class Manifest: skill: str declared: Scope signer: str signature: bytes chain_hash: str @dataclass class DelegationCache: records: dict = field(default_factory=dict) def get(self, issuer: str, intermediary: str): return self.records.get((issuer, intermediary)) def admit(manifest: Manifest, delegations: list[Delegation], cache: DelegationCache, now: int) -> Scope: # Enforce fail-closed: a missing delegation record is an admission failure, # never a fallback to leaf-trust. if not delegations: raise ProvenanceChainError( f"manifest {manifest.skill!r} has no retrievable delegation chain; " "refusing leaf-trust admission (downgrade surface)" ) effective = manifest.declared for d in delegations: if d.expires_at <= now: raise ProvenanceChainError( f"delegation {d.issuer}->{d.intermediary} expired at {d.expires_at}" ) cached = cache.get(d.issuer, d.intermediary) if cached is None: # Cache miss must fail closed, not downgrade. raise ProvenanceChainError( f"delegation record {d.issuer}->{d.intermediary} not in cache; " "cannot compute scope intersection" ) if not effective.is_subset_of(cached.scope): raise ProvenanceChainError( f"scope inflation: {manifest.skill!r} declares {effective.root!r} " f"but {d.issuer}->{d.intermediary} authorized {cached.scope.root!r}" ) effective = Scope(effective.capability, cached.scope.root) # Recompute chain hash and compare to the manifest's claimed hash. h = hashlib.sha256() for d in delegations: h.update(d.signature) if h.hexdigest() != manifest.chain_hash: raise ProvenanceChainError( f"chain hash mismatch for {manifest.skill!r}: manifest claims " f"{manifest.chain_hash[:12]}..., recomputed {h.hexdigest()[:12]}..." ) return effective def build_sandbox_boundary(admitted: Scope) -> str: # The sandbox boundary MUST be derived from the intersected scope, # never from the leaf manifest's declared root. return admitted.root ```