Why does an instance accept a federated A2A peer's credential whose issuer chain verifies but whose delegation scope silently widens at the trust-anchor boundary?

**Date of Record:** 2026 December 2 **Scope:** Applies to cross-organization agent federation where Agent A (in org X) presents a Verifiable Credential (VC) to Agent B (in org Y) to authorize an A2A task handoff, and the credential's authority derives from a delegated issuer chain rooted in a trust anchor that Y holds for X. Does not apply to intra-org single-issuer credentials, nor to bearer-token schemes without delegation semantics.

Core Distinction

The failure is not signature verification failure and not revocation failure. Both of those are loud: the cryptographic check fails, the handoff aborts, an alert fires. The failure that matters is a *scope-widening* that occurs precisely at the federation seam, where two organizations each hold a locally-consistent view of what a delegated credential authorizes, and the intersection is never computed.

A2A delegation produces chains of the form: trust anchor `A_X` (Y's pinned key for X) → issuer `I_X` (X's credential-signing agent) → subject agent `A_1` (X's worker) → delegated subject `A_2` (X's sub-worker acting on behalf of `A_1`). Each hop carries a `scope` claim (a set of permitted actions, resource globs, and a `max_delegation_depth`). The invariant that *should* hold is monotonic narrowing: `scope(hop_n+1) ⊆ scope(hop_n)`, and depth strictly decreasing.

The non-obvious break: **each verifier only checks its own hop's `scope` against its own policy, never the transitive intersection down the chain.** Y's policy engine validates `A_2`'s presented credential against `A_2`'s claimed scope, confirms `A_2`'s issuer is `A_1`, confirms `A_1`'s issuer is `I_X`, confirms `I_X` chains to `A_X`. Every link is cryptographically sound. But if `A_1` (a compromised or buggy agent inside X) re-issued a delegation to `A_2` with a *broader* scope than `A_1` itself held, the chain still verifies. The widening is invisible because no party recomputes `scope(A_2) ∩ scope(A_1) ∩ scope(I_X) ∩ policy(A_X)`.

What Was Observed

A federated research-pipeline federation: org X ("compute") exposes a `data.read` and `compute.run` capability to org Y ("orchestrator") via an A2A endpoint pinned to `A_X`. X's internal architecture delegates `compute.run` from `I_X` down to per-job worker agents, each of which may spawn a helper for long-running sub-tasks.

During a routine audit, Y logged a helper agent (`A_2`, a sub-worker) invoking `data.export` — an action absent from `I_X`'s anchor scope (`I_X` held only `data.read`, `compute.run`). The credential `A_2` presented carried `scope = {data.read, compute.run, data.export}`. Trace:

  1. `I_X` issued `A_1` a credential with `scope = {data.read, compute.run}`, `max_delegation_depth = 2`.
  2. `A_1`'s delegation logic built `A_2`'s credential from a **default template** rather than by intersecting with its own received scope. The template included `data.export` because that capability existed in X's internal catalog. This is a plain code defect, but it is *only dangerous because the protocol layer never enforced narrowing*.
  3. `A_2` presented the credential to Y. Y's verifier: signature valid, chain to `A_X` valid, issuer `A_1` is a known-good X agent, `A_2`'s scope is a syntactically valid scope object. Approved.
  4. `data.export` executed against Y's dataset. No alert — the action was authorized *by the presented credential*, which Y had no reason to distrust.

The defect lived in X. The *vulnerability* lived in the protocol's verification semantics at Y. X fixed its template in 40 minutes; the federation-level invariant gap remained open for every other org using the same A2A delegation profile.

Condition of Validity

The transitive-narrowing check is only *required* — and its absence only *exploitable* — when all of the following hold:

When depth is 1, or the presenting party transmits the full chain, or scopes are non-composable, the condition does not arise.

Decision Boundary

The architectural choice is whether **narrowing is enforced at issuance (by the delegating agent) or at verification (by the relying party)**, or both.

The boundary decision: **a federated verifier must never accept a depth ≥ 2 credential on signature-and-leaf-scope alone.** Either full-chain intersection or a chain commitment with depth bound is mandatory. Anything less is trusting the peer's internal agents to be correct — which is exactly the assumption cross-org federation exists to eliminate.

Operational Effect

With the commitment-and-depth-bound guardrail in place, the observed incident degrades from silent privilege escalation to a **hard rejection at Y's verifier**: `A_2` presents `depth_remaining = 0` (leaf) but its `parent_scope_hash` references an `A_1` scope that Y has never seen and that is not committed in any chain Y holds for `A_X`. Y rejects with `UnverifiableDelegationChainError` and quarantines the task. The `data.export` never executes. X's defective template is caught at the seam, not after exfiltration.

The residual cost: Y must maintain a cache of committed ancestor-scope hashes per federation peer, refreshed on anchor rotation. A stale cache produces false rejections (fail-closed, acceptable) rather than false accepts (fail-open, unacceptable). The asymmetry is the point: at the trust-anchor boundary, the only safe default is refusal, and the invariant that makes refusal tractable is the depth bound plus the hash commitment — not the signature, which was never the weak link.

import hashlib
from dataclasses import dataclass


class UnverifiableDelegationChainError(RuntimeError):
    """Raised when a federated A2A credential's delegation chain cannot be
    reconciled against the relying party's trust anchor. Fail-closed: the
    handoff is refused and the task quarantined."""
    pass


@dataclass(frozen=True)
class FederatedCredential:
    subject: str
    issuer: str
    scope: frozenset[str]
    parent_scope_hash: str          # commitment over parent's scope set
    depth_remaining: int            # hops left before anchor


@dataclass(frozen=True)
class AnchorPolicy:
    anchor_id: str
    max_delegation_depth: int
    permitted_actions: frozenset[str]
    known_scope_hashes: frozenset[str]  # committed ancestor scopes seen for this peer


def scope_commitment(scope: frozenset[str]) -> str:
    canonical = "|".join(sorted(scope))
    return hashlib.sha256(canonical.encode()).hexdigest()


def verify_federated_credential(
    cred: FederatedCredential,
    anchor: AnchorPolicy,
) -> None:
    # Leaf scope must be within the anchor's permitted action set.
    if not cred.scope.issubset(anchor.permitted_actions):
        raise UnverifiableDelegationChainError(
            f"leaf scope {sorted(cred.scope)} exceeds anchor "
            f"{anchor.anchor_id} permitted {sorted(anchor.permitted_actions)}"
        )

    # Depth bound: a depth-2+ credential MUST carry a reconcilable commitment.
    if cred.depth_remaining > anchor.max_delegation_depth:
        raise UnverifiableDelegationChainError(
            f"depth_remaining {cred.depth_remaining} exceeds anchor bound "
            f"{anchor.max_delegation_depth}"
        )

    # The critical guardrail: if this credential is not a direct child of the
    # anchor, its parent scope commitment must be one the relying party has
    # already reconciled. An unknown commitment means an intermediate widened
    # (or forged) scope we cannot intersect against -- refuse.
    is_direct_child = cred.depth_remaining == anchor.max_delegation_depth - 1
    if not is_direct_child and cred.parent_scope_hash not in anchor.known_scope_hashes:
        raise UnverifiableDelegationChainError(
            f"unreconciled parent_scope_hash {cred.parent_scope_hash[:12]}... "
            f"for subject {cred.subject}; possible scope widening at "
            f"intermediate hop under anchor {anchor.anchor_id}"
        )


def admit_a2a_handoff(cred: FederatedCredential, anchor: AnchorPolicy) -> str:
    try:
        verify_federated_credential(cred, anchor)
    except UnverifiableDelegationChainError:
        # Quarantine, do not silently drop: emit to federation audit sink.
        return f"QUARANTINED:{cred.subject}"
    return f"ADMITTED:{cred.subject}"