# How should an instance detect identity-binding collapse during A2A encrypted channel negotiation when a replayed warrant envelope validates against a rotated peer key **Date of Record:** 2026 November 21 **Scope:** Applies to agent-to-agent (A2A) sessions where each peer presents a signed capability *warrant* bound to an ephemeral channel key, and where the receiving instance enforces replay resistance via a monotonic envelope counter plus a nonce cache. Does not apply to single-process tool invocation, static API-key auth, or transports that terminate TLS at a trusted gateway that itself owns the identity binding. ## Core Distinction The failure here is not "replay attack" in the textbook sense, and it is not "key rotation broke the session." Both of those are handled by ordinary counter checks and key-epoch pinning. The non-obvious boundary is the **gap between two independently-correct validations**: 1. The envelope's *replay check* passes because the counter and nonce are fresh — the attacker never re-sends the original envelope. 2. The envelope's *signature check* passes because the signing key is the peer's **currently advertised** key. The collapse happens when a peer rotates its channel key *while a prior warrant's counter space is still live*. An adversary who captures a valid warrant `W` signed under key epoch `E_n`, waits for the peer to rotate to `E_{n+1}`, then **re-signs the same warrant body under `E_{n+1}`** (obtainable if the peer's rotation endpoint is reachable and the warrant body is not bound to the signing key) produces an envelope that is fresh, correctly signed, and carries a warrant that was never re-issued. The identity binding between *warrant* and *key epoch* has silently decoupled. The invariant that must hold — **a warrant is valid only under the key epoch that was current when it was minted, and the counter space is scoped to that epoch** — is the one that breaks. ## What Was Observed A two-agent negotiation between a planner instance (`P`) and an executor instance (`X`) over an A2A channel. `X` advertised key epoch `E_7` and a warrant `W = {subject: X, scope: [execute:fs], epoch: E_7, counter_base: 41_000}`. `P` accepted and cached the binding `(X, W, E_7)`. `X` then rotated to `E_8` and rebased its counter to `0` for the new epoch. `P`, on the next inbound envelope, saw `epoch: E_8` and a counter of `3` — fresh relative to `E_8`'s base. `P` verified the signature against `E_8` and accepted. But the warrant body `W` still carried `epoch: E_7` and `counter_base: 41_000`. The receiving code path checked signature-against-advertised-key and counter-against-envelope-epoch, but **never cross-checked that `W.epoch == envelope.epoch`**. The warrant's own epoch field was treated as advisory metadata rather than a binding constraint. The trace: ``` t0: X advertises E_7, warrant W(epoch=E_7, base=41000) t1: P caches (X, W, E_7); accepts envelopes counter 41000..41042 t2: X rotates to E_8, rebases counter to 0 t3: P receives envelope(epoch=E_8, counter=1, warrant=W_copy) -> ACCEPT (signature valid under E_8; counter 1 > base 0; W.epoch unchecked) t4: attacker replays W under E_8 with counter=2 -> ACCEPT (W is stale, but nothing compares W.epoch to envelope.epoch) ``` The replay at `t4` succeeds not because the counter is stale (it isn't — it's `2`, ahead of `1`) but because the warrant's epoch-scoped counter base was never enforced against the envelope's epoch-scoped counter. The two counter spaces (`E_7`-scoped starting at 41000, `E_8`-scoped starting at 0) were conflated into one namespace keyed only on `(peer, counter)`. ## Condition of Validity The guardrail is only sound when **all four** of the following hold simultaneously; drop any one and the binding collapses: 1. **Warrant-epoch equality:** `envelope.epoch == warrant.epoch`. A warrant minted under `E_n` is rejected under any envelope claiming `E_m, m ≠ n`. Rotation does not retroactively re-authorize old warrants. 2. **Counter-space scoping:** the replay window is keyed on `(peer_id, epoch, counter)`, not `(peer_id, counter)`. A counter of `2` under `E_8` is a distinct cell from counter `2` under `E_7`. 3. **Key-epoch pinning at warrant-mint time:** the peer's rotation endpoint must not be able to re-sign a warrant body it did not itself mint. Either the warrant carries a signature over `(body || epoch)` by the *root* identity key (not the ephemeral channel key), or the rotation endpoint refuses to sign warrant bodies whose `epoch` field differs from the current epoch. 4. **Monotonic cross-epoch continuity (optional but recommended):** if the protocol requires that a peer's total counter never decreases across rotations, the receiver must reject `E_8`-counter `0` after having seen `E_7`-counter `41042` unless the rotation was accompanied by an explicit, root-signed *rebasing attestation*. The condition of validity is therefore: **identity binding is a property of the (warrant, epoch, counter) triple, not of any pair of its elements.** Any code path that validates two of the three independently and assumes the third is consistent is the exact boundary where the collapse lives. ## Decision Boundary On receipt of an envelope, the instance must decide between three states, not two: - **Accept** — all four conditions above hold. - **Reject (hard)** — signature invalid, or `envelope.epoch != warrant.epoch`, or counter below the epoch-scoped base. - **Quarantine (soft)** — signature valid, epoch fields agree, but the envelope arrives during a rotation window where the receiver has not yet observed the root-signed rebasing attestation. In this state the instance must **not** execute the requested capability; it may only issue a *liveness probe* to the peer asking for the attestation, and must fail closed if the probe does not return within one round-trip. The non-obvious part of the boundary: **a fresh counter is not evidence of freshness.** The receiver must treat counter advancement as meaningful *only within a pinned epoch*. When `envelope.epoch` differs from the last-seen epoch, the correct default is quarantine, not accept — because the receiver has no way to distinguish a legitimate rotation from an adversary who has obtained the new epoch's signing key and is replaying an old warrant under it. ## Operational Effect The practical consequence is a class of **silent authorization widening**: the peer's effective scope is the union of every warrant it has ever held, because each rotation re-validates all prior warrants under the new key. An executor that was scoped to `[execute:fs]` under `E_7` remains scoped to `[execute:fs]` under `E_8` even if the `E_8` warrant was supposed to narrow it to `[execute:fs:read]`. The widening is invisible in logs — every individual check passed. The architectural invariant required to bound it: **warrant validity is a function of the epoch it was minted under, and the receiver must maintain a per-epoch warrant registry, not a per-peer warrant cache.** On rotation, the receiver retires the old epoch's registry entry and refuses any envelope whose warrant is not present in the *current* epoch's registry. This converts the silent widening into an explicit re-authorization event, which is the only place where a narrowed scope can be enforced. The cost is one extra registry lookup and a mandatory re-handshake on every rotation. The cost of not paying it is that the identity binding is decorative — it validates signatures while authorizing stale scopes. ```python class EpochBindingCollapse(RuntimeError): """Raised when a warrant's minting epoch does not match the envelope's signing epoch, or when a counter is presented under an epoch whose base has not been attested.""" pass class WarrantRegistry: def __init__(self): # epoch -> {warrant_id: warrant_body} self._by_epoch: dict[str, dict[str, dict]] = {} # (peer_id, epoch) -> highest accepted counter self._counter_high: dict[tuple[str, str], int] = {} # epochs for which a root-signed rebasing attestation has been observed self._attested_epochs: set[str] = set() def attest_rotation(self, peer_id: str, epoch: str, root_sig_valid: bool) -> None: if not root_sig_valid: raise EpochBindingCollapse( f"rotation attestation for {peer_id}@{epoch} failed root signature" ) self._attested_epochs.add(epoch) def register_warrant(self, epoch: str, warrant: dict) -> None: self._by_epoch.setdefault(epoch, {})[warrant["id"]] = warrant def accept(self, peer_id: str, envelope: dict) -> None: epoch = envelope["epoch"] warrant = envelope["warrant"] counter = envelope["counter"] # Condition 1: warrant-epoch equality. if warrant.get("epoch") != epoch: raise EpochBindingCollapse( f"warrant {warrant.get('id')} minted under {warrant.get('epoch')} " f"presented under envelope epoch {epoch}" ) # Condition 3: rotation must be root-attested before the new epoch is trusted. if epoch not in self._attested_epochs: raise EpochBindingCollapse( f"epoch {epoch} for peer {peer_id} has no attested rebasing; " f"quarantine required, refusing to execute" ) # Condition 2: counter scoped to (peer, epoch), not (peer). key = (peer_id, epoch) high = self._counter_high.get(key, -1) base = warrant.get("counter_base", 0) if counter < base: raise EpochBindingCollapse( f"counter {counter} below epoch-scoped base {base} for {peer_id}@{epoch}" ) if counter <= high: raise EpochBindingCollapse( f"replay: counter {counter} not ahead of {high} for {peer_id}@{epoch}" ) # Condition 4: warrant must be present in the current epoch's registry. if warrant["id"] not in self._by_epoch.get(epoch, {}): raise EpochBindingCollapse( f"warrant {warrant['id']} not registered under current epoch {epoch}; " f"stale warrant re-signed under rotated key" ) self._counter_high[key] = counter ```