Which invariants prevent attestation replay across vendor trust-domain boundaries when agent warrants carry non-monotonic scope?

**Date of Record:** 2026 December 1 **Scope:** Applies to cross-vendor agent authentication where an Agent Attestation and Identity Framework (AAIF) warrant is minted by an issuer in trust-domain A and presented to a verifier in trust-domain B, and where the warrant's scope set is *derived* (attenuated or expanded) during the agent's execution lifecycle. Does not apply to single-domain attestation, nor to static, non-attenuable capability tokens.

Core Distinction

The distinction that matters here is between **warrant identity** (the cryptographic binding of an agent instance to an issuer's assertion) and **warrant scope** (the set of capabilities the assertion currently authorizes). Most AAIF implementations treat the signature as covering both at mint time, and assume scope only *shrinks* through delegation (the standard attenuation invariant: a delegated warrant's scope is a subset of its parent's). That subset invariant is what makes replay detection tractable—a verifier can cache `(issuer, subject, scope-hash)` and reject any previously-seen tuple.

The failure mode appears when a vendor's scope-derivation logic is **non-monotonic**: the agent's effective scope can *grow* mid-execution because a downstream tool call returns a capability grant, or because a policy engine in domain B re-evaluates the warrant against fresher revocation data and *restores* a capability that domain A had attenuated. Under non-monotonic scope, the subset invariant no longer holds, and a naive `(issuer, subject, scope-hash)` replay cache becomes unsound: the same warrant identity can legitimately present two different scope hashes that are *not* ordered by subset, and a replayed older hash can be accepted as a valid "new" presentation.

What Was Observed

Consider an agent instance `ag-7` operating under warrant `W` issued by `vendor-a.example`. `W` initially carries scope `{read:repo, write:branch}`. During a multi-step task, `ag-7` invokes a tool hosted in `vendor-b.example` that, per B's policy, returns a *capability grant* `G = {deploy:staging}`. B's AAIF verifier, on receiving `W`, re-derives effective scope as `W.scope ∪ G` and issues a re-attested warrant `W'` with scope `{read:repo, write:branch, deploy:staging}`.

Now `ag-7` presents `W'` to a *third* verifier in domain C. C's replay cache was populated when `ag-7` first presented `W` (scope hash `h1`). `W'` has scope hash `h2 ≠ h1`. Because C's cache key is `(issuer, subject, scope-hash)`, the presentation of `W'` is treated as a *novel* attestation and accepted—even though `W'` is a re-scoped derivative of an already-consumed warrant, and even though the `deploy:staging` grant was never authorized by A's original issuer policy. The grant was minted by B, whose authority to *extend* A's scope was never cryptographically established; B's verifier conflated "I can verify this warrant" with "I can extend this warrant."

The trace, concretely:

  1. `W` minted by A, scope `S_A = {read:repo, write:branch}`, signed `sig_A`, nonce `n1`.
  2. `ag-7` presents `W` to B. B verifies `sig_A`, then *locally* unions `G`, producing `W'` with scope `S_B = S_A ∪ G`, signed `sig_B` (B's key), nonce `n2`.
  3. `ag-7` presents `W'` to C. C verifies `sig_B` against B's published key, checks `S_B ⊇ S_A`? — no such check exists in C's verifier, because C only knows B as a trusted *issuer*, not as an *attenuator*.
  4. C's replay cache lookup on `(A, ag-7, hash(S_B))` misses (it cached `hash(S_A)`). Accept.
  5. `ag-7` (or a compromised instance) replays `W'` to C again later. Cache lookup on `(B, ag-7, hash(S_B))` hits if C keys on the *presenting* issuer `B`—but C keyed on the *subject's origin* `A`. Miss. Accept again.

The root cause is that the replay cache key was chosen under the assumption of monotonic attenuation, where `scope-hash` is a monotone function of delegation depth. Non-monotonic scope expansion breaks the key's injectivity with respect to the *authorization lineage*.

Condition of Validity

The subset invariant holds—and the naive replay cache is sound—only when all of the following hold:

When any one of these fails—specifically when a vendor's AAIF verifier treats "I can verify this signature" as sufficient grounds to *re-issue* with expanded scope—the invariant is violated and replay across the trust boundary becomes possible with a scope hash the cache has never seen.

Decision Boundary

The operational boundary is this: **a warrant's scope hash is a sound replay-cache key if and only if the scope-derivation relation is a partial order under subset and the verifier commits to the entire chain.** The moment a verifier in domain B performs a non-attenuating derivation (union with a local grant), it must either:

Option (a) preserves the subset invariant but requires C to understand B's grant registry—a cross-vendor coupling most deployments avoid. Option (b) preserves replay soundness at the cost of larger warrants and a chain-verification step. Choosing neither is the failure.

Operational Effect

The practical effect is that a compromised or buggy agent instance can *launder* a capability grant minted by a lenient verifier into a fresh attestation accepted by stricter verifiers, because the stricter verifier's replay cache is keyed on a scope hash that the laundering step has invalidated. The blast radius is bounded by the set of verifiers that trust the lenient issuer as an attenuator—but in multi-vendor meshes, that set is often the entire federation, since trust anchors are typically configured per-issuer without distinguishing mint-authority from attenuate-authority.

The guardrail is a verifier-side check that every presented warrant's signed payload includes a `parent_chain_hash` and that the replay cache keys on `(subject, parent_chain_hash, scope_hash)` with an explicit subset assertion: `S_presented ⊇ S_cached` must be *false* for a cache hit to be treated as novel, and `S_presented ⊆ S_cached` with a matching chain hash must be treated as a replay. This bounds the failure to the case where the chain hash itself is forged, which reduces to the underlying signature scheme's security.

import hashlib
from dataclasses import dataclass
from typing import FrozenSet


class NonMonotonicScopeReplay(RuntimeError):
    """Raised when a warrant presentation violates the attenuation invariant
    and cannot be safely keyed by scope-hash alone."""
    pass


@dataclass(frozen=True)
class Warrant:
    issuer: str
    subject: str
    scope: FrozenSet[str]
    parent_chain_hash: str  # hash of all ancestor signatures, or "" for root
    signature: str

    def chain_hash(self) -> str:
        h = hashlib.sha256()
        h.update(self.parent_chain_hash.encode())
        h.update(self.signature.encode())
        return h.hexdigest()

    def scope_hash(self) -> str:
        return hashlib.sha256(
            "|".join(sorted(self.scope)).encode()
        ).hexdigest()


class ReplayCache:
    def __init__(self) -> None:
        # key: (subject, chain_hash) -> set of consumed scope hashes
        self._seen: dict[tuple[str, str], set[str]] = {}

    def check_and_record(self, w: Warrant, cached_scope: FrozenSet[str] | None) -> None:
        key = (w.subject, w.chain_hash())
        consumed = self._seen.setdefault(key, set())

        if w.scope_hash() in consumed:
            raise NonMonotonicScopeReplay(
                f"replay: warrant for {w.subject} under chain {w.chain_hash()[:12]} "
                f"already consumed scope {w.scope_hash()[:12]}"
            )

        # The attenuation invariant: a re-presented warrant under the same
        # chain must have scope that is a SUBSET of the previously cached scope.
        # If it is not a subset, the derivation was non-monotonic and the
        # scope-hash key is unsound — refuse rather than extend trust.
        if cached_scope is not None and not w.scope.issubset(cached_scope):
            raise NonMonotonicScopeReplay(
                f"non-monotonic scope expansion for {w.subject}: "
                f"{sorted(w.scope - cached_scope)} not present in cached scope; "
                f"replay cache key is unsound across this trust boundary"
            )

        consumed.add(w.scope_hash())


def verify_presentation(
    w: Warrant,
    cache: ReplayCache,
    cached_scope: FrozenSet[str] | None,
) -> None:
    if not w.parent_chain_hash and w.issuer not in {"vendor-a.example"}:
        # Root warrants may only be minted by configured trust anchors.
        raise NonMonotonicScopeReplay(
            f"root warrant minted by non-anchor issuer {w.issuer}"
        )
    cache.check_and_record(w, cached_scope)