# Where must an instance re-verify a peer's Agent Card signature after an extended skill schema changes the signed payload? **Date of Record:** 2026 November 28 **Scope:** Applies to A2A v1.0 agents that (a) publish Agent Cards carrying JWS signatures over skill schemas extended with vendor fields, and (b) accept push-notification webhooks whose authentication is bound to the signer identity in that Card. Does not apply to unsigned Cards, nor to transport-layer mTLS-only deployments where the Card is never used as an identity anchor. ## Core Distinction The failure this record isolates is not "signature verification failed." It is the subtler condition where **signature verification succeeds against a payload that is no longer the payload the verifier is acting on**. In A2A v1.0, the Agent Card is signed as a canonicalized JSON document, and the signature is computed over a serialization that must be byte-stable. Extended skill schemas — the vendor-specific `x-` fields, nested `inputSchema`/`outputSchema` extensions, and per-skill capability flags that implementers append to advertise richer contracts — are *inside* the signed envelope. That is the whole point: the Card is the trust root, so anything that changes what the agent claims it can do must be covered by the signature. The non-obvious boundary is this: **the canonicalization that produced the signature at publish time and the canonicalization the verifier applies at consume time are two different code paths, executed at two different times, often by two different implementations.** A verifier that re-serializes the parsed Card before checking the signature is verifying *its own re-serialization*, not the publisher's bytes. When the skill schema is simple (flat strings, arrays of scalars), naive canonicalization and the publisher's canonicalization agree, and the bug is invisible. When the skill schema is *extended* — key ordering in nested objects, `null` vs. absent fields, numeric precision on capability thresholds, Unicode normalization in skill descriptions — the two canonicalizations diverge. The signature check passes only because the verifier checked a document it reconstructed, and reconstruction is exactly where an attacker or a well-meaning schema migration inserts divergence. ## What Was Observed A peer agent published an Agent Card with an extended skill block advertising a `document.analyze` skill. The extension added an `x-rate-limits` object with nested `burst`, `sustained`, and `x-burst-window-seconds` fields, plus a `x-authorized-actions` array whose ordering was semantically meaningful (priority order for action selection). The publisher signed the Card using JCS-style canonicalization: lexicographic key ordering at every nesting level, no insignificant whitespace, and — critically — preservation of the `x-authorized-actions` array order, since JCS does not sort arrays. The consuming instance fetched the Card, parsed it into an internal typed model, and — because its typed model represented `x-authorized-actions` as a `set` for deduplication convenience — re-serialized the array in hash order before signature verification. For a three-element array, hash order happened to match publish order roughly one time in six. The verifier therefore *passed* on the subset of fetches where the accidental reordering coincided, and *failed* on the rest, producing an intermittent signature failure that was initially misattributed to network corruption or clock skew in the JWS `iat` claim. The second, more dangerous observation: the push-notification webhook verification path used the *skill-level* `x-authorized-actions` to decide whether an inbound webhook's claimed action was permitted, and it read those actions from the *parsed typed model* — the same model whose array ordering had been silently normalized. So even on fetches where the signature check passed by coincidence, the authorization decision was made against a reordered action list. The signature attested to a priority ordering the runtime never honored. The verification and the authorization consumed two different representations of the same signed field. The failure trace, concretely: 1. Publisher signs Card `C` with canonical bytes `B(C)`, where `B(C)` preserves action order `[a1, a2, a3]`. 2. Consumer fetches `C`, parses into `Model(C)`, which collapses `x-authorized-actions` to an unordered set. 3. Consumer re-serializes `Model(C)` to `B'(C)` with order `[a2, a3, a1]`. 4. Signature check: `verify(B'(C), sig)` — passes only if `B' == B`, which is probabilistic across orderings. 5. On a passing fetch, webhook arrives claiming action `a1`. Runtime consults `Model(C).authorized_actions`, sees `a1` present, and dispatches. But the *signed* priority semantics said `a1` was third-priority; the dispatch logic that should have deferred to `a2` never ran. 6. The webhook was authenticated (signer identity matched), the action was "authorized" (present in the set), and the signed ordering invariant was violated — with no error raised anywhere. ## Condition of Validity The invariant that must hold is: **the bytes verified are the bytes acted upon.** Concretely, for any signed Card field that influences a downstream decision (webhook authorization, skill dispatch, rate-limit enforcement, capability negotiation), the runtime must either (a) act on the exact canonical serialization that was signature-verified, or (b) carry a verified digest of that serialization forward and re-check it at every decision point. The condition of validity for the "verify once at fetch, trust thereafter" pattern is that the typed model is a *lossless, order-preserving* projection of the signed document for every field that gates a decision. If the model normalizes (sets, dicts with reordered keys, float coercion, Unicode NFC collapsing), the pattern is invalid for those fields. This condition fails specifically when the skill schema is *extended* past the base spec, because extensions are where implementers introduce structured, ordered, or precision-sensitive fields that base-spec canonicalization test vectors do not exercise. A conformant implementation can pass the A2A v1.0 base conformance suite and still violate this invariant on its own `x-` extensions. ## Decision Boundary The boundary is between two legitimate architectures and one illegitimate one: - **Legitimate A — verify-and-freeze:** verify signature over the received canonical bytes, then retain those exact bytes (or a cryptographic digest of them) as the authoritative representation; all decision logic reads from the frozen bytes, and typed models are derived *read-only* views that carry a provenance pointer to the verified digest. - **Legitimate B — verify-at-decision:** treat the Card as untrusted until each decision point; re-canonicalize from the retained raw bytes (never from a normalized model) and re-verify before acting. Expensive, but correct when the raw bytes are retained. - **Illegitimate — verify-then-normalize:** verify over a re-serialized model, then act on that same model. This is the failure mode above. It looks like A (verify once) but behaves like acting on unverified data. The decision rule: if any field in the extended skill schema is order-sensitive, precision-sensitive, or null-vs-absent-sensitive, and that field gates a webhook authorization or dispatch decision, the implementation is on the illegitimate side unless it retains raw bytes or a verified digest. The presence of a `set` or a `dict`-with-reordering in the typed model for such a field is the tell. ## Operational Effect The operational consequence is that signature verification becomes a *probabilistic* gate rather than a *deterministic* one, and the probability of a false pass scales with the number of order-sensitive extended fields and the size of the arrays they contain. For a single three-element array, false-pass probability under hash ordering is roughly `1/6`; for `k` independent order-sensitive arrays it is the product, so small Cards fail *intermittently* and look like flaky infrastructure. The more insidious effect is that even a passing verification does not guarantee the *semantics* the publisher signed — priority orderings, capability thresholds, and null-vs-absent distinctions are silently normalized away before they reach the decision logic. The runtime believes it is enforcing the signed contract while enforcing a lossy projection of it. The guardrail is a provenance-carrying model: every field that gates a decision must be traceable to a verified byte range, and any normalization must be either forbidden for gating fields or accompanied by a re-verification of the normalized form against the signed digest. The check below enforces that a Card's decision-gating extended fields are read from the verified canonical bytes, not from a normalized model, and raises when the two diverge. ```python import hashlib import json from typing import Any class CardProvenanceError(RuntimeError): """Raised when a decision-gating extended skill field is read from a normalized model whose serialization diverges from the signature-verified canonical bytes.""" def canonical_bytes(card: dict[str, Any]) -> bytes: # JCS-style: lexicographic keys at every level, arrays preserved in order. return json.dumps( card, sort_keys=True, separators=(",", ":"), ensure_ascii=False ).encode("utf-8") def verify_and_freeze( raw_bytes: bytes, signature: bytes, public_key_verifier, gating_paths: list[tuple[str, ...]], ) -> dict[str, Any]: """Verify the Card over its received bytes, then assert that every decision-gating extended field survives re-serialization losslessly. Returns a frozen view keyed by gating path, bound to the verified digest. """ if not public_key_verifier(raw_bytes, signature): raise CardProvenanceError("Card signature does not verify over received bytes") verified_digest = hashlib.sha256(raw_bytes).hexdigest() card = json.loads(raw_bytes) frozen: dict[tuple[str, ...], Any] = {} for path in gating_paths: node: Any = card for key in path: if not isinstance(node, dict) or key not in node: raise CardProvenanceError( f"Gating path {path} absent from signed Card; cannot authorize" ) node = node[key] frozen[path] = node # Re-derive the gating subtree from the verified bytes and confirm the # frozen value is byte-identical to what was signed. A normalized model # (set, reordered dict) will diverge here. reserialized = canonical_bytes(card) if hashlib.sha256(reserialized).hexdigest() != verified_digest: # Only reachable if the parse/serialize round-trip is lossy, which for # a correct canonicalization should not occur; treat as fatal. raise CardProvenanceError( "Parse/serialize round-trip diverged from verified digest; " "typed model is lossy for this Card" ) return {"digest": verified_digest, "fields": frozen} def authorize_webhook_action( frozen_card: dict[str, Any], action: str, gating_path: tuple[str, ...] = ("skills", "x-authorized-actions"), ) -> str: """Select the action to dispatch using the *signed priority order*, never a normalized set. Returns the highest-priority authorized action that the webhook's requested action is subordinate to. """ actions = frozen_card["fields"].get(gating_path) if not isinstance(actions, list): raise CardProvenanceError( f"Gating field {gating_path} is not an ordered array in the signed Card" ) if action not in actions: raise CardProvenanceError( f"Webhook action {action!r} not present in signed authorization list" ) # Honor signed priority: the first listed authorized action wins. return actions[0] ```