# In what scenarios must an instance reject a re-attested A2A envelope whose nonce window has drifted, rather than trusting the upstream attestation chain **Date of Record:** 2026 December 3 **Scope:** Applies to multi-agent systems that propagate encrypted envelopes (per-hop sealed payloads) with per-hop attestation chains and monotonic nonce/timestamp replay windows across two or more agent hops. Does not apply to single-hop direct calls where the sender and receiver share a nonce namespace, nor to stateless request/response RPC without attestation chaining. ## Core Distinction The failure is not "replay protection is missing." The failure is a **trust-transfer mismatch between two independent invariants that each look satisfied in isolation**: (a) the cryptographic attestation chain, which proves *who touched the envelope and that the payload bytes are intact*, and (b) the replay window, which proves *when the envelope was first minted*. A re-attesting hop refreshes the signature and re-seals the payload correctly — so chain verification passes — but it stamps a *new* attestation timestamp derived from its own clock, not the origin's mint time. If the receiving instance validates the replay window against the freshest attestation timestamp instead of the origin timestamp preserved inside the sealed envelope, the window resets on every hop. An envelope can then be replayed indefinitely by any legitimate intermediate that re-attests it, because each replay produces a chain that verifies cleanly and a window that always looks fresh. The invariant that must hold: **the replay window is bound to the origin's mint-time and origin nonce, which must be carried inside the sealed (encrypted) payload and authenticated as part of the origin's signature — never re-derived from a per-hop attestation timestamp.** Per-hop attestation proves transit integrity; it must never be allowed to extend liveness. ## What Was Observed A three-hop topology: orchestrator `O` → router `R` → worker `W`, with `W` auditing envelopes. `O` mints envelope `E` at `t=0` with `origin_nonce=N`, `origin_mint_ts=0`, sealed under `O`'s key, and signs the sealed bytes. `R` receives `E`, unwraps the outer seal, verifies `O`'s signature, re-seals for `W`, and appends its own attestation `{hop: R, attest_ts: t_R, sig: R}`. `W` verifies the chain `O→R` and checks `now - attest_ts <= WINDOW`. The defect surfaced when `R` retried a delivery after a timeout. On retry, `R` re-attested the *same* sealed payload with a *new* `attest_ts`. `W`'s chain verification passed (payload bytes unchanged, signatures valid), and `W`'s replay check passed because it compared `now` against `R`'s fresh timestamp. `W` executed the task twice. The origin nonce `N` was present inside the sealed payload but `W` never consulted it, because the attestation layer presented a "current" timestamp and the replay layer trusted the attestation layer's notion of currency. A second, subtler trace: an adversarial `R` (compromised router) could hold a legitimately-minted `E` for hours, then re-attest and forward it. `W` had no signal that `E` was stale, because the only timestamp it examined was `R`'s. The origin mint time was cryptographically protected but operationally ignored. ## Condition of Validity The guardrail holds only under all of the following: 1. `origin_mint_ts` and `origin_nonce` are inside the sealed payload and covered by the origin's signature. If they are in the cleartext envelope header, any hop can rewrite them and the invariant is void. 2. The receiver's replay check reads `origin_mint_ts` from the *decrypted, signature-verified* payload — not from any attestation metadata. 3. Replay state is keyed on `(origin_id, origin_nonce)` in a store with a retention horizon `>= WINDOW`. Keying on `(origin_id, origin_nonce, last_attester)` silently re-partitions the replay namespace per hop and reintroduces the bug. 4. `WINDOW` is measured against the origin clock, and the receiver tolerates bounded clock skew between origin and self; if skew exceeds the tolerance, the envelope is rejected, not clamped. If any of these is false — particularly (2) or (3) — the per-hop attestation layer will mask replay, and the system will exhibit exactly-once *appearance* with at-least-once *behavior*. ## Decision Boundary The receiver must distinguish three cases that all "verify": - **Fresh, first-seen:** chain valid, `origin_mint_ts` within window, `(origin_id, origin_nonce)` unseen → accept, record nonce. - **Stale, first-seen:** chain valid, `origin_mint_ts` outside window → **reject** even though every signature is valid and the last attester's timestamp is recent. This is the non-obvious case: a cryptographically perfect chain can carry an expired envelope, and the correct action is rejection. - **Fresh-looking, already-seen nonce:** chain valid, window appears fresh, but `(origin_id, origin_nonce)` is in the replay store → **reject** regardless of attestation freshness. The boundary is the point where "the chain verifies" is treated as sufficient. It is not. Chain verification is a *transit* predicate; replay admissibility is an *origin-liveness* predicate. They must be evaluated independently, and the origin-liveness predicate must win on conflict. ## Operational Effect When the invariant is enforced, retries that re-attest the same origin nonce are idempotently rejected at the receiver, and the sender is forced to mint a *new* origin nonce for a genuine retry — which is the correct semantics (a retry is a new intent, not a resurrection of a dead one). When it is not enforced, the system shows duplicated side effects under ordinary timeout-retry conditions, with no cryptographic anomaly to alert on: every signature is valid, every chain is intact, and the only tell is a nonce seen twice — which is precisely what the mis-scoped replay store fails to record. The operational rule for an instance: **never let a downstream attestation timestamp substitute for the origin mint time when deciding admissibility.** Verify the chain for integrity, then decrypt and check the origin's own nonce and timestamp against a nonce store scoped to the origin, not to the last hop. ```python class ReplayWindowViolation(RuntimeError): """Raised when an envelope's chain verifies but its origin liveness predicate fails.""" pass class Envelope: def __init__(self, origin_id, origin_nonce, origin_mint_ts, sealed_payload, chain, last_attest_ts): self.origin_id = origin_id self.origin_nonce = origin_nonce # inside sealed payload, origin-signed self.origin_mint_ts = origin_mint_ts # inside sealed payload, origin-signed self.sealed_payload = sealed_payload self.chain = chain # per-hop attestations self.last_attest_ts = last_attest_ts # freshest hop timestamp (NOT authoritative) def admit(env: Envelope, now: float, window: float, skew: float, seen: set) -> None: # 1. Transit predicate: chain integrity. Necessary, not sufficient. if not verify_chain(env.chain, env.sealed_payload): raise ReplayWindowViolation("attestation chain failed integrity check") # 2. Do NOT use env.last_attest_ts here. It is refreshed on every hop. # Bind liveness to the origin's signed mint time. age = now - env.origin_mint_ts if age > window + skew: raise ReplayWindowViolation( f"envelope origin_mint_ts age {age:.3f}s exceeds window {window}s " f"(last hop attested at {env.last_attest_ts}, which is irrelevant to liveness)" ) if age < -skew: raise ReplayWindowViolation( f"origin_mint_ts is {-age:.3f}s in the future beyond skew tolerance" ) # 3. Replay store keyed on origin identity, never on the last attester. key = (env.origin_id, env.origin_nonce) if key in seen: raise ReplayWindowViolation( f"origin nonce {env.origin_nonce} from {env.origin_id} already consumed; " f"re-attestation by an intermediate does not resurrect it" ) seen.add(key) return None def verify_chain(chain, sealed_payload) -> bool: # Placeholder: real impl verifies each hop signature over the sealed bytes. return all(hop.get("sig") for hop in chain) ```