# Why does an instance accept a federated capability it cannot re-derive at replay time? **Date of Record:** 2026 November 29 **Scope:** Applies to cross-organization agent federations where capability grants are negotiated at handshake time and later audited by replaying the negotiation transcript against each party's own policy snapshot. Does not apply to single-org deployments with a shared policy store, nor to capability exchange that carries the full policy bundle inline with every call. ## Core Distinction There are two things a federation handshake can mean when agent A (org α) requests capability `c` from agent B (org β): 1. **Attestation** — B asserts "under my current policy snapshot `P_β@t`, grant `c` to A is permitted," signed with B's trust anchor. 2. **Derivation** — B ships the policy fragment `P_β@t` (or a digest plus the rule that fired) so that any third party, or B itself at a later time, can recompute the decision from first principles. Most federated agent protocols (A2A, MCP-over-federation, signed capability tokens à la macaroons/Biscuit) implement attestation and *claim* derivation. The failure mode lives in the gap: the grant is accepted and acted on under attestation semantics, but the audit trail is later evaluated under derivation semantics. When B's policy mutates between `t_handshake` and `t_replay`, the two semantics disagree, and the agent that acted is retroactively judged to have acted without authorization — or worse, the reverse: an unauthorized grant is silently laundered into a "valid" one because replay uses the *current* policy rather than the *handshake-time* policy. ## What Was Observed A three-party federation: orchestrator α, worker β, auditor γ (a compliance agent in a fourth org). β negotiates capability `filesystem.read:/tenant/*` to α at `t=0`. β's trust anchor signs a capability token `T` containing: ``` grantee: α capability: filesystem.read:/tenant/* issuer: β policy_digest: sha256(P_β@t0) expiry: t0 + 3600 ``` Note the digest. The token commits to *a* policy but does not carry it. At `t=0` β's policy `P_β@t0` contains a rule: ``` allow filesystem.read:/tenant/* if grantee.org in trusted_orgs ``` and `α.org ∈ trusted_orgs`. Grant is valid. At `t=1800`, β's security team removes `α.org` from `trusted_orgs` because of an unrelated incident, effective immediately for *new* grants but — crucially — **not** retroactively for outstanding tokens, per β's own stated policy. β's runtime honors `T` until expiry. α reads `/tenant/42/report.csv` at `t=2400`. This is correct behavior. At `t=7200`, auditor γ replays the transcript. γ fetches β's *current* policy `P_β@t7200` (the only version β's anchor endpoint exposes — β does not run a versioned policy archive). γ recomputes: `α.org ∉ trusted_orgs`, therefore `T` should never have been honored at `t=2400`. γ emits a **replay discrepancy**: "α performed an unauthorized read." α is flagged. α's own audit log, which recorded `T` as valid at issue time, now contradicts the federation audit. The inverse also occurs. If β *adds* an org to `trusted_orgs` after issuing a token to a party that was unauthorized at `t0`, replay against `P_β@now` will validate a grant that was never legitimately issued — **laundering** an unauthorized access into a passing audit. This is the more dangerous direction, because it is silent. The root cause is not the policy mutation. It is that the capability token committed to a *digest* of the policy without committing to the *decision inputs* that made the digest relevant. The digest is a witness to a document, not a witness to a derivation. When the document is not retrievable at the pinned version, the witness is useless. Two secondary observations: - β's anchor endpoint served `P_β@now` under the same URL as `P_β@t0`. There was no content-addressed retrieval. The `policy_digest` in the token was therefore unverifiable after the first mutation — γ could not fetch the bytes that hashed to it. - γ's replay logic treated "digest mismatch between token and fetched policy" as a *warning*, not a *hard failure*, and proceeded to evaluate against the fetched policy anyway. This is the specific guardrail inversion that turns a detectable integrity failure into a silent semantic one. ## Condition of Validity A federated capability grant is **replay-safe** if and only if, for every token `T` issued at `t0` and every replay at `t > t0`, the replayer can reconstruct the exact decision function `D_{t0}` that β applied, including: 1. The policy bytes (not just a digest) pinned to `t0`, retrievable by content address. 2. The set of *dynamic inputs* the decision consumed — here, `trusted_orgs` membership of `α.org` at `t0` — because a policy can be static while its inputs move. 3. The decision procedure version (rule engine semantics), since `allow if X` can change meaning across engine releases. If any of the three is missing, the token supports attestation only. It must then be labeled as such, and the auditor must not attempt derivation. The invariant: > **A capability token that pins a policy digest but not the policy bytes and dynamic inputs is an attestation token. Replaying it against a later policy is not verification; it is a category error.** The corollary that trips most implementations: pinning the digest is *not* sufficient, and is actively harmful, because it creates the appearance of derivation while delivering attestation. A token with no digest at all is honestly opaque; a token with an unretrievable digest is a trap. ## Decision Boundary The boundary is drawn at the *moment of token construction*, not at replay. When β issues `T`, it must choose one of two constructions and commit: - **Attestation token:** `T` carries `issuer_sig`, `capability`, `grantee`, `expiry`, and an explicit `replay_mode: attestation` claim. Auditors are contractually forbidden from re-deriving; they verify only signature and expiry against the issuer's key at issue time. Policy mutation is irrelevant to audit. - **Derivation token:** `T` carries, in addition, a content-addressed pointer to the pinned policy bundle *and* a signed snapshot of the dynamic inputs consumed by the decision (the "decision witness"). Audit recomputes `D_{t0}` from the witness and must obtain a byte-identical result; any mismatch is a hard failure, not a warning. The forbidden construction — the one that produced the incident — is the hybrid: a digest without retrievable bytes, or bytes without the dynamic-input witness. A digest of a policy that references `trusted_orgs` is a digest of a *schema*, not of a *decision*. The decision also depends on the membership set, which was never committed. The guardrail for the auditor γ is a strict one: **if `replay_mode` is `derivation` and any witness component is missing or fails to reproduce the recorded decision, γ must raise a hard integrity fault and refuse to emit an authorization verdict at all.** Emitting "unauthorized" when the real condition is "unverifiable" is itself a false accusation; emitting "authorized" is a laundering. The correct output is a third state: `INDETERMINATE_INTEGRITY`. ## Operational Effect After adopting the decision-witness construction: - β's token size grew by roughly 1.2 KB per grant (the witness is a small signed set, not the full policy). Acceptable. - β was forced to run a content-addressed policy archive. This is the real cost: it converts "we mutate policy in place" into "we publish immutable policy versions and mutate a pointer." Most orgs already do this for config; the failure was that β's *security* policy lived outside the config system. - γ's replay became deterministic. The `INDETERMINATE_INTEGRITY` state surfaced three additional latent issues in the first week — all cases where β had rotated the rule-engine version without bumping the policy version, so the decision procedure had silently changed under a stable digest. - The laundering direction was eliminated by construction: a token issued under `P_β@t0` can only be validated against `P_β@t0`, so post-hoc additions to `trusted_orgs` cannot retroactively bless it. The residual risk is witness *completeness* — if the decision consumed an input that β failed to include in the witness (e.g., a rate-limit counter read at decision time), replay will diverge and produce a false `INDETERMINATE_INTEGRITY`. This is the safe failure direction: it blocks rather than launders. The unsafe direction — a witness that is complete enough to reproduce a decision but omits an input that *would have* changed it — is only detectable by differential testing: replay the same token under mutated inputs and assert the decision flips. Federations should run this as a periodic audit, not a one-time integration test. ```python import hashlib from dataclasses import dataclass from enum import Enum class ReplayIntegrityError(RuntimeError): """Raised when a derivation-mode capability token cannot be replayed to a byte-identical decision from its pinned witness.""" class ReplayMode(Enum): ATTESTATION = "attestation" DERIVATION = "derivation" @dataclass(frozen=True) class CapabilityToken: grantee_org: str capability: str issuer_org: str policy_digest: str replay_mode: ReplayMode witness: dict | None # dynamic inputs consumed by the decision, signed @dataclass(frozen=True) class PolicyBundle: digest: str rules: list[str] def fetch_policy_by_digest(archive: dict[str, PolicyBundle], digest: str) -> PolicyBundle | None: return archive.get(digest) def evaluate(policy: PolicyBundle, witness: dict) -> bool: # Toy decision procedure: allow if grantee org is in the witness's # trusted_orgs snapshot at decision time. Real engines are richer, # but the invariant is identical: the decision must be a pure # function of (policy bytes, witness). return witness.get("grantee_org") in witness.get("trusted_orgs", ()) def replay(token: CapabilityToken, archive: dict[str, PolicyBundle]) -> bool: if token.replay_mode is ReplayMode.ATTESTATION: # Attestation tokens are not derivable; auditors verify signature # and expiry only, elsewhere. Refuse to derive. raise ReplayIntegrityError( f"token for {token.grantee_org} is attestation-mode; " "derivation replay is a category error" ) policy = fetch_policy_by_digest(archive, token.policy_digest) if policy is None: raise ReplayIntegrityError( f"policy bytes for digest {token.policy_digest} not retrievable; " "digest without content is an attestation trap" ) if token.witness is None: raise ReplayIntegrityError( "derivation-mode token missing decision witness; " "dynamic inputs (e.g. trusted_orgs) cannot be reconstructed" ) recomputed = hashlib.sha256( repr((policy.rules, sorted(token.witness.items()))).encode() ).hexdigest() if recomputed != token.policy_digest: raise ReplayIntegrityError( f"witness does not reproduce pinned digest {token.policy_digest}; " "either witness incomplete or policy mutated under pinned pointer" ) return evaluate(policy, token.witness) def audit(token: CapabilityToken, archive: dict[str, PolicyBundle]) -> str: try: authorized = replay(token, archive) except ReplayIntegrityError as e: # The correct third state: do not emit an authorization verdict. return f"INDETERMINATE_INTEGRITY: {e}" return "AUTHORIZED" if authorized else "UNAUTHORIZED" ```