# In what scenarios must an instance reject a chained MCP tool manifest when the trust-anchor path exceeds its declared delegation depth mid-handoff **Date of Record:** 2026 November 23 **Scope:** Applies to LLM agent instances that consume MCP tool manifests whose `signature_chain` contains two or more delegating issuers (cross-org federation). Does not apply to single-issuer manifests signed directly by the instance's own configured trust anchor, where chain length is definitionally 1. ## Core Distinction A signed MCP tool manifest is not a boolean trust decision. It is a *path* decision: the manifest carries a `signature_chain` — an ordered list of issuer records, each co-signing a `delegation_grant` that names the next issuer and a `max_delegation_depth` integer. The receiving instance holds a local `trust_anchors` set. Verification succeeds only if there exists a chain from a trusted anchor to the manifest's leaf signer where **every hop's remaining depth budget is non-negative at the point of consumption**. The non-obvious failure is this: depth budgets are *consumed at handoff time*, not at manifest-issuance time. An org A→B→C federation can be perfectly valid when the manifest is minted, then become invalid because an intermediate agent (B) re-signs or re-wraps the manifest during a multi-agent handoff, spending one unit of delegation depth that the original issuer never budgeted for. The manifest's cryptographic signatures all verify. The chain is intact. And the instance must still reject it. The distinction that matters operationally: **signature validity ≠ delegation authority**. A verifier that checks "does every signature in the chain validate against the previous issuer's public key" will accept a manifest whose delegation depth has been exhausted. The authority check is a separate, ordered fold over the chain, and it is the one that fails silently. ## What Was Observed A three-org federation: `org-alpha` (root anchor, configured locally on the agent), `org-beta` (tool provider), `org-gamma` (a sub-agent swarm that re-hosts beta's tools under its own manifest for baton-passing). Alpha issues beta a grant with `max_delegation_depth: 1` — enough for beta to delegate once, to gamma. Gamma mints a manifest, signs it, and appends its grant. The agent verifies: alpha→beta signature valid, beta→gamma signature valid, gamma→manifest signature valid. All green. Then gamma's swarm re-wraps the manifest to hand a task to a fourth worker instance `gamma-2` inside the same org, appending a `gamma→gamma-2` grant hop *without* incrementing the depth counter (the wrapper code treated intra-org hops as depth-free). The chain now has four hops against a budget of 1. The signatures still all verify. The agent accepted the manifest, invoked the tool, and the tool executed with gamma-2's credentials — three delegations removed from the anchor that authorized it. The failure trace: 1. `verify_signatures(chain)` returns `True` — every link validates cryptographically. 2. `fold_depth(chain)` is never called, or is called against the *issuer's* declared depth rather than the *consumed* depth. 3. The manifest's `leaf_issuer` (`gamma-2`) is not the issuer alpha delegated to (`gamma`), and the intermediate `gamma→gamma-2` hop is intra-org and thus unsigned by any anchor-adjacent party. 4. Tool executes. The audit log records the *leaf* issuer, not the exhausted chain, so post-hoc attribution points at gamma-2, which has no federation relationship with alpha at all. The compounding factor: the re-wrap happened *mid-task*, inside a baton-pass between two gamma workers. The original manifest the agent had cached and verified at task start was replaced by a re-signed variant. If the agent had pinned the manifest hash at first verification and refused re-verification against a mutated chain, the failure would not have occurred. It did not pin. ## Condition of Validity The invariant that must hold for acceptance: > For a manifest `M` with chain `[i_0, i_1, ..., i_n]` where `i_0` is a local trust anchor, acceptance requires that for every `k` in `1..n`, the grant `i_{k-1} → i_k` declares `remaining_depth ≥ 1`, and the fold decrements by exactly 1 per hop **including intra-org hops**, and `M.leaf_issuer == i_n`, and the manifest content hash equals the hash pinned at first verification within the current task. Three sub-conditions, each independently necessary: - **Depth monotonicity across org boundaries.** Intra-org re-wraps are not depth-free. A hop is a hop. Any implementation that special-cases "same org" as depth-zero is exploitable by exactly the re-wrap above. - **Leaf identity binding.** The signer of the manifest body must be the terminal chain element. A manifest signed by `gamma-2` but whose chain terminates at `gamma` is a mismatch, not a valid delegation. - **Manifest pinning within task scope.** Once an agent has verified a manifest and begun using its tools, the chain it verified is the chain it must keep using until the task checkpoint. Re-verification against a mutated chain mid-task is a state-transfer attack surface, not a feature. ## Decision Boundary The precise line the instance must draw: - **Accept** when the fold reaches the leaf with `remaining_depth ≥ 0` at every step, leaf identity matches, and the manifest hash is unchanged since task start. - **Reject and halt the tool call** when the fold would go negative — even if all signatures verify — and emit a `DelegationDepthExhausted` fault naming the hop index where depth hit zero. - **Reject and re-negotiate** when the manifest hash changed mid-task: discard cached tool bindings, re-run full chain verification from the anchor, and only resume if the *new* chain also satisfies the fold. Do not silently swap. - **Never** treat "signature valid" as sufficient for "authorized." These are separate gates and the second one is the one that bounds blast radius. The boundary is *not* "reject untrusted anchors" — that is the easy case. The boundary is "reject a chain that is fully trusted at every link but whose aggregate delegation exceeds what the anchor granted." That is the case that slips through signature-only verifiers. ## Operational Effect An instance that enforces the depth fold closes the re-wrap escalation: gamma cannot manufacture authority beyond what alpha delegated, regardless of how many internal hops it inserts. The cost is that intra-org tool re-hosting requires the org to request depth from its upstream anchor up front — a federation-negotiation step, not a runtime wrapper trick. This is the correct pressure: depth budgets are a scarce authorization resource, and treating them as free within an org is the bug. The manifest-pinning requirement closes the mid-task mutation surface: a baton-pass that re-signs the manifest forces re-verification from the anchor, which surfaces the depth exhaustion at handoff rather than after tool execution. Pinning also gives the audit log a stable chain to attribute against, so post-hoc forensics point at the hop that overran, not the leaf that happened to sign last. The residual risk is depth-budget *replay*: a valid chain re-presented after its grant has been revoked upstream. That is out of scope here and requires revocation-list checking at verify time — a separate invariant. Within the scope of this record, the fold plus pin plus leaf-binding triple is sufficient and each element is independently load-bearing; drop any one and the re-wrap succeeds. ```python from dataclasses import dataclass from typing import Optional class DelegationDepthExhausted(RuntimeError): """Raised when a signed MCP manifest's chain consumes more delegation depth than the trust anchor granted, even though every signature in the chain verifies cryptographically.""" class ManifestMutationDetected(RuntimeError): """Raised when the manifest content hash changed mid-task after the agent had pinned and verified an earlier chain.""" class LeafIssuerMismatch(RuntimeError): """Raised when the manifest body signer is not the terminal element of the verified signature chain.""" @dataclass(frozen=True) class Grant: issuer: str subject: str remaining_depth: int # depth budget this grant confers on subject @dataclass(frozen=True) class Manifest: leaf_issuer: str content_hash: str chain: tuple # ordered tuple[Grant], index 0 = hop from anchor def verify_and_authorize( manifest: Manifest, trust_anchors: frozenset, pinned_hash: Optional[str], signatures_ok: bool, ) -> str: # Gate 1: cryptographic signatures must all verify. if not signatures_ok: raise DelegationDepthExhausted("signature verification failed") # Gate 2: manifest must not have mutated since task-scoped pin. if pinned_hash is not None and manifest.content_hash != pinned_hash: raise ManifestMutationDetected( f"manifest hash {manifest.content_hash} != pinned {pinned_hash}" ) # Gate 3: chain must originate at a local trust anchor. if not manifest.chain or manifest.chain[0].issuer not in trust_anchors: raise DelegationDepthExhausted( f"chain root {manifest.chain[0].issuer if manifest.chain else None} " f"is not a configured trust anchor" ) # Gate 4: ordered fold over delegation depth. Intra-org hops are NOT free. depth = None for idx, grant in enumerate(manifest.chain): if idx == 0: depth = grant.remaining_depth else: prev = manifest.chain[idx - 1] if grant.issuer != prev.subject: raise DelegationDepthExhausted( f"chain discontinuity at hop {idx}: " f"{grant.issuer} != {prev.subject}" ) depth -= 1 # every hop costs one unit, regardless of org if depth < 0: raise DelegationDepthExhausted( f"delegation depth exhausted at hop {idx} " f"(issuer={grant.issuer}, subject={grant.subject}); " f"anchor granted {manifest.chain[0].remaining_depth}" ) # Gate 5: leaf identity binding. if manifest.leaf_issuer != manifest.chain[-1].subject: raise LeafIssuerMismatch( f"manifest signed by {manifest.leaf_issuer} but chain " f"terminates at {manifest.chain[-1].subject}" ) return manifest.leaf_issuer ```