Which invariants prevent A2A v1.0 Agent Card signature replay across skill-extension negotiation rounds

**Date of Record:** 2026 December 2

**Scope:** Applies to A2A v1.0 peers that publish a signed Agent Card (JWS detached or compact) and negotiate `extendedSkills`/capability extensions across multiple rounds. Does not apply to single-shot capability discovery where the card is fetched and consumed once with no subsequent negotiation state.

Core Distinction

The A2A v1.0 Agent Card is a *signed capability manifest*, not a signed *negotiation transcript*. The JWS over the card authenticates the publisher's claim at card-issuance time: "agent X at origin O asserts it supports skill set S under schema version V." It does **not** authenticate the *pairing* of that card with a subsequent negotiation exchange. This is the boundary that operators routinely cross without noticing.

The failure mode is not signature forgery. It is **signature transplant**: a valid, freshly-signed Agent Card from a legitimate peer is replayed into a negotiation round it was never bound to, because the verifier validates the JWS over the card bytes but never checks that the card digest is bound to the negotiation nonce, the requested `extendedSkills` delta, or the responding agent's session identity. The signature is genuine; the *binding* is absent.

What Was Observed

A two-peer topology: an orchestrator `O` and a worker `W`. `W` publishes an Agent Card `C_W` containing `skills: [summarize, translate]` and, in `capabilities.extensions`, an entry `{uri: "a2a://ext/streaming-sse/1.0", required: false}`. `O` fetches `C_W`, verifies the detached JWS against `W`'s JWKS (resolved via `jku` in the protected header, pinned to `W`'s origin), and stores the verified card plus its digest `d0 = SHA-256(canonical(C_W))`.

Round 1: `O` requests an extension upgrade — `extendedSkills: ["a2a://ext/streaming-sse/1.0"]` with `required: true`. `W` responds with a *new* Agent Card `C_W'` that flips the extension to `required: true`, re-signs it, and returns it alongside the negotiation acceptance. `O` verifies `C_W'` — signature valid — and proceeds.

The defect surfaces on **round 2**. `O` re-requests the base skill set (a fallback path triggered by a timeout on `W`'s streaming endpoint). `W`, under load, serves a *cached* `C_W` (the pre-upgrade card, `required: false`). `O` verifies it: signature valid against `W`'s JWKS, digest `d0` matches the stored round-0 digest. Verification passes. `O` now believes `W` supports streaming as *optional* and downgrades its own transport expectation mid-session, while `W`'s actual runtime is still configured for `required: true` and will reject non-streaming calls with `EXTENSION_REQUIRED`. The session deadlocks: `O` sends non-streaming requests (`W` rejects), `W` waits for streaming requests (`O` no longer sends them). Neither side's signature check ever failed.

The trace is: `verify(C_W') → ok` at round 1; `verify(C_W) → ok` at round 2 (stale but validly signed); no check that `digest(C_W) == digest(C_W')` or that the round-2 card is *newer* than the round-1 card or bound to the round-2 nonce. The verifier's invariant was "the card is authentic," when the required invariant was "the card is the *current* authenticated state of this negotiation."

Condition of Validity

The replay is only possible when all of the following hold, and an invariant must be stated against each:

  1. **Detached/compact JWS with no `iat`/`exp` or with a validity window longer than the negotiation.** If the card carries a short `exp` (≤ negotiation TTL) and the verifier enforces it, a stale round-0 card fails closed. Most implementations set `exp` to hours or omit it entirely.
  2. **No monotonic version or sequence field bound into the signed payload.** If `C_W'` carried `cardVersion: 2` and the verifier tracked `lastSeenVersion`, a downgrade to `1` would be rejected. A2A v1.0 does not mandate a version field; it is an extension.
  3. **Digest pinning is per-fetch, not per-session.** `O` pinned `d0` at round 0 but did not *replace* the pin on round 1, nor assert monotonicity. The pin became a stale acceptance rather than a floor.
  4. **The negotiation nonce is not inside the signed payload.** Because the JWS covers only card bytes, the card cannot be bound to "this negotiation, this round." Any valid card from `W`'s history is acceptable.

Decision Boundary

The boundary is between **stateless authenticity verification** (is this card signed by `W`?) and **stateful negotiation integrity** (is this card the current, non-regressed capability state for *this* session?). A2A v1.0's JWS layer answers only the first. The second must be enforced by the orchestrator as a session invariant:

Operational Effect

Without these invariants, the system exhibits **silent capability divergence**: both peers hold validly-signed cards, both pass verification, and both operate on contradictory capability beliefs. The failure is invisible to signature monitoring (all checks green) and invisible to schema validation (both cards are well-formed). It surfaces only as a transport-level deadlock or, worse, as a *silent* fallback where `O` routes around a capability `W` actually requires, producing degraded-but-successful responses that mask the divergence.

The architectural consequence: **JWS verification is necessary but not sufficient for negotiation state.** The signed card is a capability *assertion*, and a session must maintain a monotonic, nonce-bound *ledger* of accepted assertions. Treating each verified card as an independent fact — the natural reading of "the signature is valid" — is precisely the bug. The invariant that prevents it is: *a card is admissible into a session only if its signed version is ≥ the session's high-water mark and its digest is bound to the current negotiation round.* Anything less admits replay of a genuine signature into a context it was never issued for.

import hashlib
import json
from dataclasses import dataclass, field


class CardReplayError(RuntimeError):
    """Raised when a validly-signed Agent Card is replayed into a negotiation
    round it is not bound to (stale version, superseded digest, or missing
    nonce binding)."""


@dataclass
class SignedCard:
    payload: dict          # canonical card bytes as dict
    jws: str               # detached/compact JWS (assumed pre-verified by JWKS)
    digest: str = ""

    def __post_init__(self):
        canon = json.dumps(self.payload, sort_keys=True, separators=(",", ":")).encode()
        self.digest = hashlib.sha256(canon).hexdigest()


@dataclass
class SessionLedger:
    peer_id: str
    high_water_version: int = -1
    accepted_digests: set = field(default_factory=set)
    superseded_digests: set = field(default_factory=set)

    def admit(self, card: SignedCard, round_nonce: str) -> None:
        version = card.payload.get("cardVersion")
        if version is None:
            raise CardReplayError(
                f"peer {self.peer_id}: card lacks cardVersion; cannot enforce monotonic floor"
            )
        if version < self.high_water_version:
            raise CardReplayError(
                f"peer {self.peer_id}: version regression {version} < {self.high_water_version}"
            )
        if card.digest in self.superseded_digests:
            raise CardReplayError(
                f"peer {self.peer_id}: digest {card.digest[:12]} was superseded; replay rejected"
            )
        bound_nonce = card.payload.get("negotiationNonce")
        if bound_nonce != round_nonce:
            raise CardReplayError(
                f"peer {self.peer_id}: card not bound to round nonce "
                f"{round_nonce!r} (got {bound_nonce!r})"
            )
        # Admit: advance high-water mark and supersede prior digests.
        self.superseded_digests |= self.accepted_digests
        self.accepted_digests.add(card.digest)
        self.high_water_version = version


def negotiate_round(ledger: SessionLedger, card: SignedCard, round_nonce: str) -> None:
    # JWS signature is assumed already verified against pinned JWKS above this layer.
    ledger.admit(card, round_nonce)