How does an instance detect a stale Agent Card signature after an extended-skill renegotiation in A2A v1.0

**Date of Record:** 2026 December 1 **Scope:** Applies to A2A v1.0 peers that sign Agent Cards with JWS and renegotiate extended skills after initial discovery; does not cover unsigned dev-mode cards or single-skill static deployments where skills never change post-publication.

Core Distinction

The Agent Card signature binds the *entire* card payload, including the `skills[]` array and any `extensions` block. A2A v1.0 permits a server to publish extended skills (additional `skills` entries plus an `extensions` map with per-extension capability URIs) *after* the base card is already trusted by a client. The non-obvious boundary is this: **signature validity is a property of the byte-exact canonical payload, not of the semantic capability set.** When a peer renegotiates an extended skill, it must re-sign the whole card. A client that caches the verified card by `(agentId, cardVersion)` and then fetches only the *skills delta* over the skills-negotiation channel will accept new capability grants that were never covered by any signature it verified. The failure is not a broken signature—it is a *correct* signature over an *old* payload being treated as authorization for a *new* capability.

What Was Observed

In a two-agent deployment (orchestrator `O`, worker `W`), `O` performs discovery: fetches `W`'s Agent Card, verifies the JWS against `W`'s published `jku`/`kid`, records `cardHash = SHA-256(canonical(card))` and `cardVersion = 3`. Later, a task requires a new extended skill. `W` responds on the skills-negotiation channel with a `SkillUpdate` frame:

{ "type": "skill_update",
  "agentId": "W",
  "cardVersion": 4,
  "addedSkills": [{"id":"code.exec.v2","inputModes":["text/x-python"],"security":["mtls"]}],
  "extensions": {"urn:a2a:ext:codeexec": "https://w.example/ext/codeexec/v2"} }

`W` *did* re-sign its full card (version 4) and published it at the well-known URL, but the `SkillUpdate` frame carries no signature and no `cardHash`. `O`'s negotiation handler merges `addedSkills` into its in-memory capability map, updates `cardVersion` to 4, and — critically — leaves `cardHash` pointing at the version-3 canonical bytes. The worker has now granted `code.exec.v2` (which permits arbitrary code submission over mTLS) under an authorization record whose integrity anchor is a signature over a payload that does not contain `code.exec.v2`. The signature still verifies. The hash still matches. The capability is new. The invariant "verified hash ⇒ every active capability is covered by that hash" is silently broken.

The trace is deterministic and reproducible: discovery → verify(v3) → record hash(v3) → skill_update(no sig) → merge → dispatch(uses v4 skill) → no re-verification because `cardVersion` changed but `cardHash` did not, and the merge path never recomputes `cardHash`.

Condition of Validity

The guardrail is a single invariant enforced at the merge boundary:

> **For every capability in the active set, there must exist a verified `cardHash` whose canonical payload contains that capability, and the `cardVersion` associated with that hash must equal the `cardVersion` under which the capability was admitted.**

Operationally this means the skills-negotiation handler must treat a `SkillUpdate` as *untrusted input* and refuse to merge until it has re-fetched the full card at the advertised `cardVersion`, re-verified the JWS, recomputed `cardHash`, and confirmed that `addedSkills ⊆ skills(card@v4)`. A `SkillUpdate` frame is a *hint to re-fetch*, never an authorization. This holds only when the client can reach the well-known card URL at negotiation time; in partitioned or air-gapped topologies the correct behavior is to *reject* the extended skill (fail closed) rather than merge it, because the capability cannot be bound to a verified payload.

Decision Boundary

The detection rule is not "did the version change" (that fires on benign re-signs) and not "does the signature verify" (it always does here). It is:

The subtle case: a peer that re-signs the full card but sends the `SkillUpdate` *before* the new card is fetchable (eventual consistency of the card CDN). A naive client re-fetches, gets the *old* card, sees `addedSkills ⊄ oldCard`, and — if it treats "not found in card" as "benign lag" — merges anyway. The correct handling is to fail closed and retry with bounded backoff; "lag" is indistinguishable from "forged grant" at the client, so the client must not guess.

Operational Effect

Without the invariant, a compromised or buggy worker can escalate its own capability surface by emitting a `SkillUpdate` for a privileged skill while leaving its signed card unchanged—the client's signature check is a no-op against the actual grant. With the invariant, the escalation requires forging a JWS over a full card containing the privileged skill, which is the security boundary A2A v1.0 intended. The cost is one full-card fetch per version transition; the benefit is that `cardHash` becomes a genuine authorization anchor rather than a decoration. Push-notification webhook verification inherits this: the webhook `Authorization` token is scoped to a `cardVersion`, and a token minted under v3 must not authorize callbacks that reference v4 skills, or the webhook becomes a side channel around the card-verification invariant.

import hashlib
import json
from dataclasses import dataclass, field


class StaleCardSignatureError(RuntimeError):
    """Raised when a capability is admitted under a cardHash that does not cover it."""


@dataclass
class VerifiedCard:
    agent_id: str
    card_version: int
    card_hash: str
    skills: frozenset


@dataclass
class SkillUpdate:
    agent_id: str
    card_version: int
    added_skills: list
    extensions: dict = field(default_factory=dict)


def canonical_hash(card_payload: dict) -> str:
    canonical = json.dumps(card_payload, sort_keys=True, separators=(",", ":")).encode()
    return hashlib.sha256(canonical).hexdigest()


def merge_skill_update(
    cached: VerifiedCard,
    update: SkillUpdate,
    refetch_card,
) -> VerifiedCard:
    """Merge a SkillUpdate only if the new skills are covered by a freshly verified card.

    refetch_card(agent_id, card_version) -> (payload: dict, jws_valid: bool)
    """
    if update.card_version == cached.card_version:
        # Same version: any added skill is an unauthorized grant under this hash.
        if update.added_skills:
            raise StaleCardSignatureError(
                f"SkillUpdate for {update.agent_id} adds {update.added_skills} "
                f"at unchanged cardVersion {cached.card_version}; no re-signature covers them"
            )
        return cached

    payload, jws_valid = refetch_card(update.agent_id, update.card_version)
    if not jws_valid:
        raise StaleCardSignatureError(
            f"Re-fetched card v{update.card_version} for {update.agent_id} failed JWS verification"
        )

    fresh_hash = canonical_hash(payload)
    fresh_skills = frozenset(s["id"] for s in payload.get("skills", []))
    for skill in update.added_skills:
        if skill["id"] not in fresh_skills:
            raise StaleCardSignatureError(
                f"Skill {skill['id']} not present in verified card v{update.card_version} "
                f"(hash {fresh_hash}); refusing to bind capability to stale hash {cached.card_hash}"
            )

    return VerifiedCard(
        agent_id=update.agent_id,
        card_version=update.card_version,
        card_hash=fresh_hash,
        skills=fresh_skills,
    )