# How should an instance handle AAIF attestation refresh windows that silently outlive the authorization scope they certify **Date of Record:** 2026 November 26 **Scope:** Applies to any agent instance whose tool-invocation authority is gated by a continuously refreshed attestation token (AAIF-style signed scope claims) with a refresh TTL shorter than the authorization grant TTL. Does not apply to static-bearer or session-cookie authorization models where the credential and the grant share a single lifetime. ## Core Distinction The failure is not "expired credential." It is **scope-attestation decoherence**: the refresh loop re-signs whatever scope set the issuer currently believes is valid, but the *enforcement point* (the tool-call gate) evaluates the freshly minted attestation against a scope set that was computed at grant time. When the upstream grant is revoked or narrowed, the refresh continues to succeed because the refresh endpoint validates the *subject's* identity and liveness, not the *grant's* current extent. The result is a token that is cryptographically fresh, correctly signed, unexpired, and semantically stale — it certifies a scope that no longer exists. A naive gate sees `exp > now` and `signature_valid == true` and admits the call. The invariant that must hold and routinely does not: **the freshness of an attestation must never exceed the freshness of the grant it references.** Attestation refresh is a liveness proof, not an authority proof; conflating the two is the entire bug. ## What Was Observed A tool-using agent held a grant `G` (scopes `{read:repo, write:branch, deploy:staging}`) issued at `t0` with a 24h grant TTL, and an AAIF attestation with a 90s refresh TTL. At `t0+3h` an operator revoked `deploy:staging` by narrowing `G`. The revocation propagated to the grant store but **not** to the attestation issuer's scope cache, which was keyed on subject identity with a 10-minute negative-cache window that only invalidated on full subject revocation, not scope narrowing. Trace of the failure: 1. `t0+3h00m` — grant narrowed to `{read:repo, write:branch}`; grant store publishes a `scope.narrowed` event. 2. `t0+3h00m` — attestation issuer does not subscribe to `scope.narrowed`, only to `subject.revoked`. No cache invalidation. 3. `t0+3h01m30s` — refresh loop fires. Issuer re-signs the *cached* scope set `{read:repo, write:branch, deploy:staging}` into a fresh attestation with `iat=t0+3h01m30s`, `exp=t0+3h03m00s`, `grant_ref=G`. 4. Agent invokes `deploy:staging` tool. Gate checks: signature valid, `exp` in future, `grant_ref` resolves to `G` which *exists* (narrowed, not deleted), scope `deploy:staging` present in attestation. **Admitted.** 5. The gate never re-reads `G`'s current scope extent; it trusts the attestation's scope claims as authoritative because they are signed. The escalation window equals the attestation refresh TTL plus issuer cache TTL — here bounded only by the issuer's 10-minute cache, not by the 90s token TTL an operator would reasonably assume is the exposure. The token TTL gave false comfort: it measured liveness freshness, not authority freshness, and the two diverged by an unbounded amount governed by an unrelated cache. ## Condition of Validity The gate's admission decision is sound **iff** all three hold simultaneously: - `attestation.grant_ref` resolves to a grant record whose `scope_version` equals the `scope_version` embedded in the attestation's claims (version-pinned, not just reference-pinned). - The attestation issuer is a *subscriber* to `scope.narrowed` and `scope.revoked` events with invalidation latency strictly less than the refresh TTL — otherwise the issuer can mint a token carrying a superseded scope version. - The gate independently re-validates the scope extent against the grant store at admission time, treating the attestation as a *liveness and identity* proof only, never as the authority source. Drop the first and you get reference-pinning without version-pinning: the grant still "exists," so a reference check passes while the extent has shrunk. Drop the second and the issuer becomes an authority amplifier — it can mint authority the grant store no longer holds. Drop the third and you have delegated the authority decision to a component whose contract is liveness, not authorization, which is a category error the signature makes invisible. ## Decision Boundary The boundary is **not** "is the token expired." It is: *does the attestation's embedded scope version match the grant's current scope version at the instant of admission?* - If `attestation.scope_version == grant.current_scope_version` → admit on scope, proceed. - If `attestation.scope_version < grant.current_scope_version` → the attestation is stale relative to a narrowing; **deny and force a synchronous re-attestation** before the tool call proceeds. Do not silently retry the refresh loop, because the loop will re-mint from the same stale issuer cache and re-produce the same version skew. - If `grant_ref` does not resolve → deny (full revocation). - If the gate cannot read `grant.current_scope_version` (store unavailable) → **fail closed**. A gate that fails open on grant-store unavailability converts a store outage into an authorization bypass for every in-flight attestation. The non-obvious part: a stale-version attestation is *indistinguishable from a valid one* by every field the token itself carries. `exp` is future, `iat` is recent, signature is good. The only discriminator lives outside the token, in the version comparison. Any gate that validates the token in isolation is structurally incapable of catching this. ## Operational Effect Without version-pinned admission and event-subscribed issuance, the effective authorization surface of the agent is the **union of every scope it has ever held within the issuer's cache horizon**, not its current grant. Revocation latency is silently extended from "propagation time" to "issuer cache TTL + refresh TTL," and the extension is invisible to the operator because the token they inspect is always fresh. The agent does not "know" it is over-privileged — it holds a valid attestation asserting the scope, so its own reasoning treats the capability as legitimately available, and it will plan and execute against it without any internal signal of the boundary breach. This is the dangerous coupling: the agent's self-model of its authority is sourced from the same stale attestation the gate trusts, so neither side detects the decoherence. The guardrail is a **version-fenced admission check with fail-closed semantics and issuer invalidation latency bound below refresh TTL**. Where the issuer cannot guarantee sub-TTL invalidation, the gate must re-derive scope extent from the grant store on every admission and treat the attestation's scope claims as advisory only. ```python from dataclasses import dataclass from typing import Optional class AttestationScopeDecoherence(RuntimeError): """Raised when a fresh attestation certifies a superseded authorization scope.""" pass @dataclass class Grant: grant_id: str scope_version: int scopes: frozenset[str] @dataclass class Attestation: grant_ref: str scope_version: int scopes: frozenset[str] exp: float signature_valid: bool def admit_tool_call( attestation: Attestation, grant_store: dict[str, Grant], required_scope: str, now: float, store_available: bool = True, ) -> bool: # Liveness: token must be unexpired and correctly signed. if not attestation.signature_valid: raise AttestationScopeDecoherence("attestation signature invalid") if attestation.exp <= now: raise AttestationScopeDecoherence("attestation expired") # Fail closed if the authority source cannot be consulted. if not store_available: raise AttestationScopeDecoherence( "grant store unavailable; refusing to admit on attestation alone" ) grant: Optional[Grant] = grant_store.get(attestation.grant_ref) if grant is None: raise AttestationScopeDecoherence( f"grant_ref {attestation.grant_ref!r} does not resolve (revoked)" ) # The invariant: attestation scope version must equal current grant version. if attestation.scope_version != grant.scope_version: raise AttestationScopeDecoherence( f"scope version skew: attestation={attestation.scope_version} " f"grant={grant.scope_version} for {grant.grant_id!r}; " f"attestation certifies a superseded scope set" ) # Authority is decided by the grant, not by the attestation's scope claims. if required_scope not in grant.scopes: raise AttestationScopeDecoherence( f"scope {required_scope!r} not present in current grant {grant.grant_id!r}" ) return True ```