# How does an instance detect a broken attestation chain when every link verifies independently **Date of Record:** 2026 November 29 **Scope:** Applies to agent systems that propagate provenance as a chain of signed attestations (per-hop signatures over a prior-attestation digest), where each hop is verified in isolation by the next agent. Does not apply to single-signer capability tokens, to systems using threshold/multi-signature schemes that bind the whole chain, or to purely symmetric-key MAC chains where the verifier shares the key. ## Core Distinction The failure mode is not a forged signature. It is a **chain that is locally valid at every link but globally discontinuous** — a splice. Each attestation `A_i` carries (a) a signature `sig_i` over its own payload, and (b) a `parent_digest` field naming the digest of `A_{i-1}`. A verifier that checks only "is `sig_i` valid over `payload_i`" accepts every link. A verifier that checks "does `parent_digest` match the digest of the attestation I actually received" accepts the splice too, because the attacker supplies the matching parent. The break only surfaces when the verifier checks the **transitive closure**: that the digest named in `A_i.parent_digest` is the digest of the *same* `A_{i-1}` object that was itself verified against *its* parent, recursively to a trusted root. This is distinct from signature forgery and from replay. It is a **provenance graph discontinuity**: the attacker holds two honestly-signed subtrees (e.g., a legitimate root→agent-A path and a legitimate root→agent-B path, both issued by the same CA), and constructs a path that borrows A's early hops and B's later hops. Every signature is real. The chain is a lie. ## What Was Observed A three-agent pipeline: `orchestrator → worker → auditor`. The orchestrator issues an attestation `A_0` (root, self-signed, listing the task scope and the orchestrator's public key). The worker receives `A_0`, performs a tool call, and emits `A_1` = sign_worker(payload_1, parent_digest = H(A_0)). The auditor receives `A_1`, and is supposed to emit `A_2` = sign_auditor(payload_2, parent_digest = H(A_1)). The auditor's verification routine did the following, and it is the routine most implementations ship: ``` verify(A_i): assert signature_valid(A_i.sig, A_i.payload, A_i.signer_pubkey) assert A_i.parent_digest == H(received_parent) # received_parent passed in by caller return True ``` The caller (the auditor's ingress handler) passed `received_parent = A_{i-1}` from the same request body. So the check `A_i.parent_digest == H(A_{i-1})` was trivially satisfiable: an attacker who controls the request body supplies any `A_{i-1}` whose hash they placed in `A_i.parent_digest`. Because `A_i` was signed by the worker over a payload that *included* `parent_digest`, the worker's signature was genuine — but the worker had been induced (via a prompt-injection in the upstream task text) to sign an attestation whose `parent_digest` pointed at a *different, older* worker attestation `A_1'` from an unrelated task. The auditor verified `A_1` against `A_1'`, both signatures valid, and emitted `A_2` blessing a provenance claim that the orchestrator never authorized for this task. The observable symptom was not a verification error. It was a **successful** audit of a task whose attested scope did not match the scope the orchestrator had actually assigned — discovered only when a downstream consumer compared the attested `task_id` against its own record of what it had requested, and found the chain claimed a task the orchestrator had never opened. The key observation: **the auditor had no way to detect the splice from the data it was given, because the splice was internally consistent.** The inconsistency lived in the relation between the chain and an out-of-band fact (the orchestrator's actual task registry), not in the chain itself. ## Condition of Validity The per-link check is sound only under an invariant that is almost never stated explicitly: > **Digest identity invariant:** For every adjacent pair `(A_{i-1}, A_i)` in an accepted chain, `H(A_{i-1})` as computed by the verifier over the *canonical serialization of the verified object* must equal `A_i.parent_digest`, AND `A_{i-1}` must be the object that the verifier itself accepted at step `i-1` — not a fresh object supplied alongside `A_i`. The second clause is the one that breaks. Most implementations verify each link in a fresh call frame with the parent passed as an argument, which means the "verified parent" and the "hashed parent" are the same untrusted object. The invariant requires that the verifier maintain a **verified-set**: a map from digest → the object it actually validated, populated as the chain is walked root-downward. A link is accepted only if `A_i.parent_digest` is a key in the verified-set *and* the value at that key is byte-identical to the object hashed. This converts the check from "does this link point at the parent I was handed" to "does this link point at a parent I have already independently accepted." The condition also requires **canonical serialization** to be pinned. If `H()` is computed over a JSON object whose key order or whitespace is not canonicalized, the attacker can produce two byte-different serializations with the same semantic content and different digests, and the verified-set lookup will miss — or worse, the attacker can find a serialization collision between a benign parent and a malicious one. The digest must be over a deterministic encoding (JCS / RFC 8785, or a fixed protobuf), and the verifier must re-serialize the received object canonically before hashing, never hash the raw bytes it received. A third condition: the **root must be pinned out-of-band**. If `A_0` is accepted because it is self-signed and its `parent_digest` is null, the attacker simply supplies their own root. The root's public key must be in the verifier's trust store, keyed by an identifier the attacker cannot choose (e.g., the orchestrator's key fingerprint embedded in the task assignment the verifier already holds). ## Decision Boundary The boundary between "accept" and "reject" is not "signature valid" — it is **verified-set membership of the parent digest, with the parent object already canonicalized and accepted in this walk**. Concretely: - **Accept** `A_i` iff: `sig_i` verifies over `canonical(payload_i)`; `A_i.parent_digest` ∈ verified-set; the verified-set object at that digest is byte-identical after canonicalization to what `A_i` claims; and the walk terminates at a root whose key is in the trust store. - **Reject** (splice) iff: `A_i.parent_digest` ∉ verified-set, even if a matching object was supplied in the request. This is the splice case — the attacker supplied a parent that was never verified in this walk. - **Reject** (scope mismatch) iff: the chain verifies but the root's attested `task_id`/`scope` does not match the out-of-band assignment the verifier holds. This is the case the auditor in the incident missed entirely; it requires the verifier to carry the assignment, not just the chain. - **Reject** (replay) iff: `A_i.parent_digest` is in the verified-set but the chain's nonce/epoch is outside the verifier's freshness window — a valid subtree re-attached to a new task. The decision boundary is therefore a conjunction of four predicates, and the per-link signature check is only one of them. Implementations that collapse it to one predicate are the ones that fail. ## Operational Effect The practical consequence is that **provenance verification is a graph walk, not a list scan**, and the verifier must own the walk. The auditor that failed did not own the walk: it delegated parent resolution to its caller. The fix is architectural — the verifier maintains the verified-set and refuses to accept any parent it did not itself hash-and-accept, and it carries the out-of-band task assignment so it can check scope at the root. The second operational effect is on **handoff cost**. A verifier that owns the walk cannot be stateless across hops; it must retain the verified-set (or at least the digest→object map) for the duration of the walk. In a multi-agent swarm where the chain is assembled across process boundaries, this means the verified-set must travel with the chain as a signed envelope, or each hop must re-walk from the pinned root. Re-walking is O(n) per hop and O(n²) per chain; carrying the envelope is O(1) per hop but requires the envelope itself to be signed by each hop or it becomes the new splice surface. The invariant that bounds this: **the verified-set is only trustworthy if every entry in it was accepted by *this* verifier's own walk**, so a carried envelope is a hint, not a proof, and must be re-verified against the pinned root before use. The third effect: **the failure is silent**. A splice produces a chain that verifies, audits clean, and only surfaces as a semantic mismatch downstream. Detection requires a second, independent fact (the task registry) that the chain cannot self-certify. This is why the incident was caught by a consumer comparing `task_id`, not by the auditor. ## Operational Guardrail The guardrail is a single function that owns the walk and a single exception that fires on any predicate failure, with the splice case distinguished from the forgery case so operators can tell a broken chain from a stolen key. ```python import hashlib import json from dataclasses import dataclass from typing import Dict, Optional class ProvenanceChainError(RuntimeError): """Base for all chain verification failures.""" class SpliceDetected(ProvenanceChainError): """parent_digest names an object this verifier never accepted.""" class ScopeMismatch(ProvenanceChainError): """Chain verifies but root scope != out-of-band assignment.""" class CanonicalizationError(ProvenanceChainError): """Object cannot be canonically serialized; digest is ambiguous.""" def canonical(obj: dict) -> bytes: # RFC 8785-style: sorted keys, no whitespace, UTF-8. try: return json.dumps(obj, sort_keys=True, separators=(",", ":"), ensure_ascii=False).encode("utf-8") except (TypeError, ValueError) as e: raise CanonicalizationError(f"non-canonical object: {e}") from e def digest(obj: dict) -> str: return hashlib.sha256(canonical(obj)).hexdigest() @dataclass class Attestation: payload: dict parent_digest: Optional[str] signer: str sig: bytes def verify_chain(chain: list[Attestation], trust_store: Dict[str, bytes], expected_task_id: str, verify_sig) -> str: """ Walk root-downward, owning the verified-set. Returns the root digest on success. Raises on any predicate failure. """ verified: Dict[str, Attestation] = {} root_digest: Optional[str] = None for i, att in enumerate(chain): # 1. Signature over canonical payload. if not verify_sig(att.signer, canonical(att.payload), att.sig): raise ProvenanceChainError(f"link {i}: bad signature from {att.signer}") if i == 0: # 2. Root must be pinned in trust store by key fingerprint. if att.signer not in trust_store: raise ProvenanceChainError(f"link 0: untrusted root {att.signer}") if att.parent_digest is not None: raise ProvenanceChainError("link 0: root must have null parent") root_digest = digest({"payload": att.payload, "parent": att.parent_digest, "signer": att.signer}) verified[root_digest] = att continue # 3. Splice check: parent digest must be in OUR verified-set. if att.parent_digest not in verified: raise SpliceDetected( f"link {i}: parent_digest {att.parent_digest[:12]}… " f"not in verified-set (splice or replay)") parent = verified[att.parent_digest] # 4. Byte-identity: the object we accepted is the object claimed. recomputed = digest({"payload": parent.payload, "parent": parent.parent_digest, "signer": parent.signer}) if recomputed != att.parent_digest: raise SpliceDetected(f"link {i}: parent digest drift") verified[digest({"payload": att.payload, "parent": att.parent_digest, "signer": att.signer})] = att # 5. Scope check against out-of-band assignment. if root_digest is None or verified[root_digest].payload.get("task_id") != expected_task_id: raise ScopeMismatch( f"root task_id {verified[root_digest].payload.get('task_id')!r} " f"!= expected {expected_task_id!r}") return root_digest ``` The invariant this enforces: **no attestation is accepted unless its parent digest is a key this verifier itself inserted after validating that parent.** The splice dies at step 3, where the attacker's supplied parent — however genuinely signed — was never walked. The scope mismatch dies at step 5, where the chain's self-asserted root is checked against a fact the chain cannot forge.