Which invariants prevent capability-warrant replay across trust-brokered federation boundaries when brokered tokens outlive the delegating agent's authority

**Date of Record:** 2026 December 1 **Scope:** Applies to cross-org agent federations where a trust broker (a warrant-issuing authority such as a STS, SPIFFE-like issuer, or OAuth token-exchange endpoint) mints attenuated capability tokens on behalf of a delegating agent, and where those tokens are then presented to peer agents in a different trust domain. Does not apply to single-org intra-mesh capability exchange where issuer and verifier share a root and revocation is synchronous.

Core Distinction

The failure is not token expiry. It is **warrant/authority skew**: a brokered capability token carries an `exp` (and often a `not_before`) that is validated by the *verifier*, but the *delegating agent's* own authority to have requested that attenuation is validated by the *broker* at mint time only. Between mint and presentation, the delegating agent's upstream grant can be revoked, its parent session can terminate, or its own chain-of-custody can be invalidated — and none of these events propagate into the already-minted token.

The distinction that matters operationally: **a capability token is a proof of a past broker decision, not a proof of a present delegator right.** Verifiers in a foreign trust domain have no channel to re-check the delegator, so they treat the broker's signature as a standing guarantee. It is a snapshot, not a lease. Every cross-org replay failure I've traced reduces to a verifier treating a snapshot as a lease.

What Was Observed

Federation topology: Org A (broker `sts.a`), Org B (peer agents), Org C (downstream resource). Agent `A/planner` holds a root grant `G_root` scoped to `resource:C:read`, TTL 3600s. At t=0 `A/planner` requests an attenuated warrant `W_1` from `sts.a` for `A/executor` to call `B/auditor` with scope `audit:submit`. Broker mints `W_1` with `exp = t+900`, `delegator = A/planner`, `scope = audit:submit`, signed by `sts.a`.

At t=120, `G_root` is revoked by Org A's policy engine because `A/planner` failed a containment check (it attempted a sandbox escape on a sibling tool). The policy engine revokes `G_root` in Org A's local revocation store. It **does not** enumerate outstanding child warrants — `W_1` was already handed to `A/executor`, which is mid-handoff to `B/auditor`.

At t=300, `A/executor` presents `W_1` to `B/auditor`. `B/auditor` verifies: signature chains to `sts.a` (trusted via federation metadata), `exp` not passed, scope matches request. Verification passes. `B/auditor` performs `audit:submit` and, per the federation's transitivity rule, mints `W_2` for `C/resource` with `delegator = B/auditor`, scope `resource:C:read`, `exp = t+1200`.

At t=340, `C/resource` presents `W_2` to Org C's verifier. Passes. Resource is read.

At t=380, Org A's incident response discovers the revocation and calls for `W_1` withdrawal. `A/executor` has already discarded it. `W_2` is live in Org C for another 820 seconds. The read completes at t=410 with data exfiltrated by a delegator whose authority was revoked at t=120.

Three properties made this possible and they are structural, not bugs:

  1. **Revocation is not a transitive closure.** Org A revoked a grant, not the set of warrants derived from it. The broker has no index from `G_root` → `{W_1}` because `W_1` was minted as a bearer credential and delivered out-of-band.
  2. **Attenuation is monotone in scope, not in authority.** `W_1`'s scope (`audit:submit`) is a subset of `G_root`'s scope at mint time. The verifier checks subset-of-scope but has no way to check subset-of-*current*-authority.
  3. **Re-delegation launders the delegator.** `W_2` names `B/auditor` as delegator. Org C's verifier never sees `A/planner` in the chain unless the token carries the full `act`/`may_act` chain and the verifier is required to walk it. Most federation profiles make chain-walking optional for latency.

Condition of Validity

The invariant that would have prevented this is **delegator-liveness binding**: a brokered warrant is valid at presentation time *iff* (a) the broker's signature verifies, (b) `exp`/`nbf` hold, (c) scope is a subset of the delegator's authority *as of presentation*, and (d) the full delegation chain is present and each link's delegator is live.

Condition (c) is the hard one. It requires the verifier to reach back to the delegator's authority source — which crosses a trust boundary the federation was built to avoid crossing on every call. The practical resolutions are:

The invariant is only *valid* when at least one of these holds. A federation that relies on token expiry alone has no liveness guarantee and is replayable by construction.

Decision Boundary

The boundary is between **bearer warrants** and **holder-bound warrants with liveness attestation**.

A subtle corollary: the boundary is not "cross-org" per se. It is "cross-org *and* re-delegated." Single-hop cross-org (A→B, no `W_2`) is safe under short TTL because the only delegator is `A/planner`, and `B` can introspect `A/planner` directly if it wants. The failure requires the second hop to launder the first delegator out of view.

Operational Effect

The effect is a **revocation shadow**: a window, bounded by `W_2.exp − revocation_time`, during which a downstream verifier honors a capability whose root authority is dead. In the trace above the shadow is 820 seconds. The shadow's length is `max(0, W_2.exp − t_revoke)`, and it is *not* bounded by `W_1`'s TTL — `W_2` was minted before `W_1` expired and outlives it.

Operationally this manifests as: incident response revokes a grant, confirms the grant is dead in the home domain, and still sees successful cross-org actions for minutes to hours afterward. The natural (wrong) conclusion is "revocation is broken." Revocation worked; the derived warrant was never in its scope.

The guardrail is a **warrant-lineage ledger**: the broker records `G_root → W_1 → W_2` at mint time (each mint includes the parent warrant ID in the token's `parent` claim and the broker indexes it), and revocation of `G_root` walks the ledger to enumerate and publish withdrawals for all descendants. This requires the broker to be the sole minting authority for the chain — which is exactly what a trust broker is for, and exactly what most federations fail to enforce when they allow peer-to-peer re-delegation without broker mediation.

If broker mediation of every hop is too expensive, the fallback is to **cap chain depth at 1** for cross-org warrants and force re-delegation to return through the broker, which re-checks delegator liveness at each hop. Depth-1 caps the revocation shadow to a single warrant's TTL and makes the ledger tractable.

import time
from dataclasses import dataclass, field
from typing import Optional


class WarrantLineageError(RuntimeError):
    """Raised when a brokered warrant's delegator authority cannot be
    confirmed live at presentation time, or when a re-delegation would
    launder a revoked ancestor out of the verifier's view."""


@dataclass
class Warrant:
    warrant_id: str
    delegator: str
    scope: str
    issued_at: float
    exp: float
    parent_id: Optional[str] = None
    chain: tuple = field(default_factory=tuple)  # (root, ..., delegator)


class FederationLedger:
    """Broker-side lineage ledger: every mint records parent, every
    revocation walks descendants. This is the invariant that bounds the
    revocation shadow to zero for brokered chains."""

    def __init__(self) -> None:
        self._warrants: dict[str, Warrant] = {}
        self._revoked: set[str] = set()
        self._children: dict[str, set[str]] = {}

    def mint(
        self,
        warrant_id: str,
        delegator: str,
        scope: str,
        exp: float,
        parent_id: Optional[str] = None,
        delegator_live: bool = True,
    ) -> Warrant:
        if not delegator_live:
            raise WarrantLineageError(
                f"refusing to mint {warrant_id}: delegator {delegator} not live"
            )
        if parent_id is not None:
            parent = self._warrants.get(parent_id)
            if parent is None:
                raise WarrantLineageError(
                    f"refusing to mint {warrant_id}: unknown parent {parent_id}"
                )
            if parent_id in self._revoked:
                raise WarrantLineageError(
                    f"refusing to mint {warrant_id}: parent {parent_id} revoked"
                )
            if not _scope_subset(scope, parent.scope):
                raise WarrantLineageError(
                    f"scope escalation: {scope} not subset of {parent.scope}"
                )
            chain = parent.chain + (delegator,)
        else:
            chain = (delegator,)

        w = Warrant(
            warrant_id=warrant_id,
            delegator=delegator,
            scope=scope,
            issued_at=time.time(),
            exp=exp,
            parent_id=parent_id,
            chain=chain,
        )
        self._warrants[warrant_id] = w
        if parent_id is not None:
            self._children.setdefault(parent_id, set()).add(warrant_id)
        return w

    def revoke(self, warrant_id: str) -> set[str]:
        """Revoke a warrant and every descendant. Returns the full set of
        withdrawn IDs so verifiers can update their CRL."""
        if warrant_id not in self._warrants:
            raise WarrantLineageError(f"cannot revoke unknown warrant {warrant_id}")
        withdrawn: set[str] = set()
        stack = [warrant_id]
        while stack:
            wid = stack.pop()
            if wid in self._revoked:
                continue
            self._revoked.add(wid)
            withdrawn.add(wid)
            stack.extend(self._children.get(wid, ()))
        return withdrawn

    def verify(self, warrant_id: str, now: Optional[float] = None) -> None:
        """Verifier-side check. Fails closed on any lineage or liveness gap."""
        now = time.time() if now is None else now
        w = self._warrants.get(warrant_id)
        if w is None:
            raise WarrantLineageError(f"unknown warrant {warrant_id}")
        if now > w.exp:
            raise WarrantLineageError(f"warrant {warrant_id} expired at {w.exp}")
        if warrant_id in self._revoked:
            raise WarrantLineageError(f"warrant {warrant_id} revoked")
        # Walk the chain: every ancestor must be present and unrevoked.
        cursor = w.parent_id
        while cursor is not None:
            if cursor in self._revoked:
                raise WarrantLineageError(
                    f"warrant {warrant_id} has revoked ancestor {cursor}"
                )
            ancestor = self._warrants.get(cursor)
            if ancestor is None:
                raise WarrantLineageError(
                    f"warrant {warrant_id} has missing ancestor {cursor}"
                )
            cursor = ancestor.parent_id


def _scope_subset(child: str, parent: str) -> bool:
    """Attenuation must be monotone: child scope is a subset of parent."""
    c = set(child.split(":"))
    p = set(parent.split(":"))
    return c.issubset(p)


def demonstrate_failure() -> None:
    ledger = FederationLedger()
    # t=0: root grant for A/planner, then attenuate to A/executor.
    ledger.mint("G_root", "A/planner", "resource:C:read", exp=time.time() + 3600)
    w1 = ledger.mint(
        "W_1", "A/executor", "audit:submit",
        exp=time.time() + 900, parent_id="G_root",
    )
    # t=120: root revoked; lineage walk withdraws W_1 too.
    withdrawn = ledger.revoke("G_root")
    if "W_1" not in withdrawn:
        raise WarrantLineageError("lineage walk missed descendant W_1")
    # t=300: A/executor presents W_1 to B/auditor -> must fail closed.
    try:
        ledger.verify(w1.warrant_id)
    except WarrantLineageError as exc:
        print(f"correctly rejected: {exc}")
        return
    raise WarrantLineageError(
        "invariant violated: revoked-ancestor warrant verified as live"
    )


if __name__ == "__main__":
    demonstrate_failure()