# Which invariants prevent capability-attestation replay from silently widening a federated agent's trust envelope **Date of Record:** 2026 November 25 **Scope:** Applies to cross-org agent federations where a broker exchanges signed capability attestations (scoped warrants) between mutually-untrusting domains and caches them for reuse. Does not apply to single-org deployments with a shared trust root or to stateless tool-call gateways that re-authorize on every invocation. ## Core Distinction A capability attestation is a *claim about what an agent was permitted to do at issuance time under a specific issuer's policy*. It is not a grant in the present. The failure mode here is not forgery—signatures verify—it is **temporal and contextual replay**: a validly signed attestation, minted for one peer, one resource-scope, and one validity window, gets reused by the broker against a *different* peer or a *widened* scope because the broker's cache key omits the binding dimensions that made the attestation safe. The signature stays green the whole way. The trust envelope widens without a single cryptographic check failing. The invariant that must hold: **an attestation is admissible only if the tuple (issuer, subject, audience-peer, resource-scope, validity-window, nonce) is preserved bit-for-bit from issuance through every broker hop, and any cache hit that resolves a different tuple is a hard rejection—not a cache miss to be re-fetched, and not a scope-merge to be reconciled.** ## What Was Observed A three-org federation: Org A (issuer, runs the trust broker), Org B and Org C (resource holders). Agent `a:planner` in Org A needs to read from both B and C. B issues `a:planner` a read-warrant scoped to `b:dataset/finance`, audience `b`, TTL 300s. C issues a separate warrant scoped to `c:dataset/ops`, audience `c`, TTL 300s. The broker caches attestations keyed on `(subject, issuer)` only—a reasonable-looking optimization, since "an agent's capabilities from an issuer are stable." On the second hop, `a:planner` presents its B-warrant while addressing C. The broker computes cache key `(a:planner, B)`, finds the B-warrant, and—because the downstream C-gateway only checks *signature validity and subject match*, not audience—the call succeeds. `a:planner` now reads `c:dataset/ops` under a B-issued warrant that never mentioned C. The trace looks like this: 1. `a:planner` → broker: `present(warrant_B, target=C)`. 2. Broker: `key = (subject=a:planner, issuer=B)`; cache hit on `warrant_B`. 3. Broker → C-gateway: forwards `warrant_B` with request for `c:dataset/ops`. 4. C-gateway: verifies signature (valid, B's key), verifies `subject == a:planner` (true), checks scope `c:dataset/ops` against warrant's `resource-scope` field — **but the warrant's scope field is `b:dataset/finance`, and the gateway's scope check was written as a prefix/substring test that a missing-audience path skips entirely.** Admission granted. No error fires. The audit log records a successful, signature-valid, subject-matching authorization. The envelope silently expanded from {B:finance} to {B:finance, C:ops}. ## Condition of Validity The replay is only possible when *all three* of the following co-occur, which is why it hides: - **Cache key under-specification.** The broker keys on a projection of the attestation tuple that drops `audience` and `resource-scope`. Any two attestations sharing `(subject, issuer)` collide. - **Audience non-enforcement at the relying party.** The downstream gateway treats `audience` as advisory metadata rather than a mandatory equality check against its own identity. This is the load-bearing defect: the broker's bad key would be harmless if C rejected a warrant whose `audience != c`. - **Scope check expressed as a predicate the warrant can vacuously satisfy.** A substring or "field absent means wildcard" scope test lets a warrant minted for `b:*` pass a check for `c:ops` when the audience gate is skipped. Remove any one and the replay fails closed. The dangerous configuration is the one where each component's local check *looks* correct in isolation: the broker's cache is a legitimate optimization, the gateway's signature check is correct, the scope parser handles its documented cases. The invariant is violated only in the composition. ## Decision Boundary The boundary is **whether the broker is permitted to treat attestation identity as a stable property of (subject, issuer) or must treat it as a function of the full binding tuple.** It must be the latter. Concretely: - **Cache key must be the full binding tuple**, or the cache must be disabled for cross-audience hops. A cache hit that does not reproduce `audience`, `resource-scope`, and `nonce` exactly is a *rejection*, not a re-fetch: re-fetching would launder the mismatch into a fresh, legitimately-scoped warrant and hide the fact that the agent asked for the wrong thing. - **Relying parties must enforce `audience == self` as a hard equality**, before any scope logic. An attestation whose audience does not name the verifier is not "possibly relevant"—it is inadmissible. - **Scope checks must be closed-world**: an absent scope field is *no scope*, never wildcard. The default on a malformed or truncated scope is deny. - **Nonce must be single-use per (audience, scope)**: replay of the same nonce against a different audience is a distinct violation from replay against the same audience, and both must be rejected. The decision boundary in operational terms: *if you cannot reconstruct the full issuance tuple from the cache entry alone, you may not serve from cache.* Partial-tuple caches are the failure surface. ## Operational Effect When the invariant holds, the blast radius of a compromised or buggy broker is bounded to *availability* (it can refuse to forward) rather than *confidentiality* (it cannot widen scope), because the relying party independently re-derives admissibility from the full tuple. When it fails, the federation's trust model degrades from "each org enforces its own envelope" to "the broker's cache key defines the global envelope"—a single under-specified dict key becomes the effective security policy for every member. The failure is silent, signature-valid, and audit-log-clean, which means it is typically discovered only by a scope-diff audit that reconstructs, per subject, the set of (audience, scope) pairs actually exercised versus the set ever issued. Run that diff; a non-empty set difference on the *exercised-minus-issued* side is this bug, and it will not appear in any error log. ```python from dataclasses import dataclass from typing import Optional class AttestationReplayError(RuntimeError): """Raised when an attestation is served or admitted outside its full binding tuple.""" pass @dataclass(frozen=True) class Attestation: issuer: str subject: str audience: str resource_scope: str nonce: str expires_at: float def binding_tuple(att: Attestation) -> tuple: # The invariant: identity is the FULL tuple, never a projection. return (att.issuer, att.subject, att.audience, att.resource_scope, att.nonce) class BrokerCache: def __init__(self) -> None: self._store: dict = {} def put(self, att: Attestation) -> None: self._store[binding_tuple(att)] = att def resolve(self, presented: Attestation, target_audience: str, now: float) -> Attestation: # Reject any request whose audience does not match the target hop. if presented.audience != target_audience: raise AttestationReplayError( f"audience mismatch: warrant audience={presented.audience!r} " f"addressed to {target_audience!r}; refusing cross-audience reuse" ) # Reject expired attestations before any cache interaction. if presented.expires_at <= now: raise AttestationReplayError( f"expired attestation nonce={presented.nonce!r} expires_at={presented.expires_at}" ) key = binding_tuple(presented) cached = self._store.get(key) if cached is None: # A miss on the full tuple is a REJECTION, not a re-fetch: # re-fetching would launder a mismatched request into a fresh warrant. raise AttestationReplayError( f"no attestation matching full binding tuple {key!r}; " "partial-tuple cache hit is not admissible" ) return cached def admit(cache: BrokerCache, presented: Attestation, target_audience: str, requested_scope: str, now: float) -> Attestation: att = cache.resolve(presented, target_audience, now) # Closed-world scope: exact match, absent field is no scope, never wildcard. if not att.resource_scope or att.resource_scope != requested_scope: raise AttestationReplayError( f"scope violation: warrant scope={att.resource_scope!r} " f"cannot satisfy requested={requested_scope!r}" ) return att ```