What structural signals indicate a signed A2A artifact has outlived the Agent Card that authorized it

**Date of Record:** 2026 December 1 **Scope:** Applies to A2A v1.0 peers exchanging signed artifacts under an Agent Card whose `capabilities`, `securitySchemes`, or signing `publicKey` may rotate between task acceptance and artifact delivery. Does not cover unsigned transports or MCP-only tool invocation, where no warrant chain exists to invalidate.

Core Distinction

The failure mode is not signature forgery and not card forgery. It is **warrant staleness across a task's lifetime**: an artifact is cryptographically valid against the key material embedded in the Agent Card the *client* fetched at task creation, while the *server* has since rotated its signing key, narrowed `capabilities`, or revoked the `securityScheme` that scoped the original handoff. The signature verifies; the authorization does not. A2A v1.0 treats the Agent Card as a discovery document, not a lease. Nothing in the task lifecycle state machine forces re-resolution of the card between `submitted` and `completed`, so the artifact arrives bound to a warrant that no longer exists at the origin.

The structural signal is a **three-way mismatch** between (a) the `cardHash` the client pinned at task submission, (b) the `keyId`/`jku` referenced in the artifact's detached JWS header, and (c) the current card served at `/.well-known/agent.json`. When (a) ≠ current card but (b) resolves cleanly against (a), you have a stale-warrant artifact — the most dangerous class, because every individual check passes.

What Was Observed

A planner agent (`A`) delegated a document-summarization task to a worker (`B`) at T0. `A` fetched `B`'s Agent Card, which declared `capabilities.streaming: true`, `securitySchemes.bearer.rotationEpoch: 7`, and a signing key `kid: b-sig-07`. `A` pinned `cardHash = sha256(canonical(card))` into the task's `metadata.pinnedCard` and transitioned the task to `working`.

At T1, mid-task, `B`'s operator rotated the signing key to `b-sig-08` and simultaneously *narrowed* `capabilities` — removing `artifacts.push` for the tenant class `A` belonged to, following an incident. `B` continued executing the already-accepted task (correctly — the task was in-flight). At T2, `B` emitted the final artifact, signed with `b-sig-08`.

`A` received the artifact. Its verification path did this:

  1. Extract detached JWS, read `kid: b-sig-08`.
  2. Look up `b-sig-08` — **not present** in the pinned card's `publicKeys`. Lookup returns `None`.
  3. Fall through a permissive branch: "unknown kid → re-fetch card and retry."
  4. Re-fetched card now carries `b-sig-08` *and* the narrowed capabilities. Signature verifies.
  5. `A` accepted the artifact and advanced the task to `completed`.

The artifact was authentic. But `A` had, in step 3–4, silently **re-pinned to a card that no longer authorized the task it was completing**. The narrowed `capabilities` would have rejected the original delegation had `A` re-checked them — but the retry path only re-validated the *signature*, never the *capability predicate* that scoped the task. The state machine recorded `completed` on a task whose authorization basis had been revoked mid-flight. No error surfaced. The audit log shows a clean verification.

Condition of Validity

The stale-warrant acceptance is only reachable when all of the following hold simultaneously:

Remove any one condition and the failure collapses. The invariant that protects against it: **an artifact's validity is a function of the card pinned at task submission, not the card current at delivery.** Re-fetching the card to resolve an unknown `kid` is precisely the operation that violates this invariant, because it substitutes a different authorization basis mid-verification.

Decision Boundary

The boundary is not "reject unknown kids" versus "accept them." Both are wrong as blanket policies. The correct decision is **context-dependent on task state**:

The pitfall is collapsing these into a single "verify signature" routine. The signature check is necessary and insufficient; the warrant check is the one that carries the authorization semantics, and it must be evaluated against the *pinned* card, never a freshly fetched one.

Operational Effect

Systems that adopt the pinned-card invariant observe a specific signature in their failure logs: `WarrantStaleError` spikes at the exact moment an operator rotates keys, and *only* for tasks that were in-flight across the rotation. This is the correct behavior — those tasks genuinely lost their authorization basis and should fail loudly rather than complete on a substituted warrant. The cost is a burst of re-delegations at rotation time; the benefit is that no artifact ever completes a task under a card the delegating agent never agreed to.

Systems without the invariant show the opposite signature: zero errors at rotation, and a slow accumulation of `completed` tasks whose `pinnedCard` hash does not match the `cardHash` recorded in the artifact's verification trace. That divergence — pinned hash ≠ verified hash — is the forensic marker of stale-warrant acceptance, and it is invisible until an auditor replays the task and discovers the completion was authorized by a card that had already revoked the capability. The guardrail is cheap: pin the card hash at `submitted`, refuse to re-resolve it for the duration of the task, and treat any `kid` outside the pinned set as a hard failure rather than a cue to refresh.

import hashlib
import json
from dataclasses import dataclass


class WarrantStaleError(RuntimeError):
    """Raised when an artifact's signing key is not covered by the card pinned at task submission."""
    pass


@dataclass(frozen=True)
class PinnedWarrant:
    card_hash: str
    allowed_kids: frozenset[str]
    allowed_capabilities: frozenset[str]


def pin_warrant(card: dict) -> PinnedWarrant:
    canonical = json.dumps(card, sort_keys=True, separators=(",", ":")).encode()
    return PinnedWarrant(
        card_hash=hashlib.sha256(canonical).hexdigest(),
        allowed_kids=frozenset(k["kid"] for k in card.get("publicKeys", [])),
        allowed_capabilities=frozenset(card.get("capabilities", {}).keys()),
    )


def verify_artifact_against_pinned(
    artifact_jws_header: dict,
    required_capability: str,
    pinned: PinnedWarrant,
    current_card: dict,
) -> None:
    kid = artifact_jws_header.get("kid")
    if kid is None:
        raise WarrantStaleError("artifact JWS header missing kid; cannot bind to pinned warrant")

    # The load-bearing check: the signer must be covered by the card pinned at submission.
    # A re-fetch of the current card is NOT a valid substitute for this lookup.
    if kid not in pinned.allowed_kids:
        raise WarrantStaleError(
            f"artifact signed by kid={kid!r} which is absent from pinned card "
            f"{pinned.card_hash[:12]}...; refusing re-fetch-on-unknown-kid fallback"
        )

    if required_capability not in pinned.allowed_capabilities:
        raise WarrantStaleError(
            f"task requires capability {required_capability!r} not present in pinned warrant"
        )

    # Capability drift is permitted (warrant was valid at submission) but must be surfaced.
    current_caps = frozenset(current_card.get("capabilities", {}).keys())
    if required_capability not in current_caps:
        # Caller is expected to record capability_drift=True on the task; not a hard failure.
        artifact_jws_header["_capability_drift"] = True