Why does an instance fail delegated-scope attenuation when an AAIF credential chain crosses a re-issuing hop with a stale scope-cache?

**Date of Record:** 2026 December 1 **Scope:** Applies to AAIF (Agent Authority & Identity Framework) delegated-scope credential chains where an intermediate agent re-issues a downstream credential instead of forwarding the original, and where scope resolution is cached per-issuer. Does not apply to single-hop bearer tokens or to chains that forward opaque credentials verbatim without re-signing.

Core Distinction

The failure is not a signature-verification failure, and it is not a revocation-timing failure. Both of those are loud: the verifier rejects, the call aborts, the chain is visibly broken. The boundary condition here is a *silent scope-widening* that survives every cryptographic check.

AAIF delegated credentials carry a scope set `S` and an attenuation rule: a re-issuing hop may only produce `S' ⊆ S`. The subset test is the entire security invariant. It is normally enforced by intersecting the parent's scope with the child's requested scope at issuance time. The bug lives in the case where the re-issuing agent resolves the parent scope *from a cache keyed on issuer identity* rather than from the credential bytes it was actually handed. When the parent re-issues under the same issuer ID but with a *narrower* scope than the cache remembers, the cache returns the older, wider scope. The child is then signed with `S'` that is a subset of the *cached* parent scope but not of the *actual* parent scope. Every signature verifies. Every subset check passes—against the wrong parent. The delegation chain has laundered authority upward.

What Was Observed

A three-hop chain: orchestrator `O` → planner `P` → executor `E`. `O` holds a root credential with scope `{read:kb, write:kb, exec:shell, net:egress}`. `P` is a long-lived planner process with an in-memory scope cache keyed by `(issuer_id, subject_id)`. On first use, `P` resolves `O`'s scope and caches `{read:kb, write:kb, exec:shell, net:egress}`.

Later, `O` re-issues a task-specific credential to `P` for a read-only summarization task, with scope `{read:kb}`. The credential is correctly signed and correctly narrowed. `P` receives it, but its scope-resolution path consults the cache first: `(O, P)` → hits → returns the stale four-element set. `P` then mints a credential for `E` requesting `{read:kb, net:egress}` for a "fetch and summarize" subtask. The subset check runs `{read:kb, net:egress} ⊆ {read:kb, write:kb, exec:shell, net:egress}` → true. `E` is signed with `net:egress`, which `O` never granted for this task.

Observed trace at `E`:

verify_chain(E_cred) -> OK (3 signatures valid)
check_attenuation(E_cred, P_cred) -> OK ({read:kb,net:egress} ⊆ cached(O_scope))
check_attenuation(P_cred, O_cred) -> NOT RUN  # P_cred was consumed, not re-fetched
effective_scope(E) -> {read:kb, net:egress}
root_grant(O) -> {read:kb}   # for this task

The divergence is only visible if you re-derive the root grant from the *actual* `O→P` credential bytes and recompute the transitive intersection. Nothing in the normal verification path does that, because each hop trusts its local view of the parent.

The trigger condition is conjunctive: (1) an intermediate hop re-issues rather than forwards, (2) scope resolution is cached by issuer/subject rather than by credential hash or nonce, and (3) the same issuer re-issues under the same subject with a narrower scope within the cache TTL. Remove any one and the failure does not occur. This is why it hides in test suites: most tests use fresh issuer/subject pairs per case, and most production chains re-issue rarely enough that the cache expires first.

Condition of Validity

The attenuation invariant is only sound when the scope used in the subset check is *the scope of the credential that will actually be presented as the parent in the chain*, byte-for-byte. Formally, for chain `C = (c_0, c_1, ..., c_n)` where `c_i` was issued by the holder of `c_{i-1}`:

∀ i: scope(c_i) ⊆ scope(c_{i-1})

The cached-resolution path substitutes `scope_cached(issuer(c_{i-1}), subject)` for `scope(c_{i-1})`. The invariant holds only if `scope_cached(...) == scope(c_{i-1})` at check time. That equality is an *assumption*, not a guarantee, and it is exactly the assumption a re-issuing hop violates. The condition of validity is therefore: scope must be bound to the credential instance (hash, nonce, or serial), never to the issuer/subject pair. Cache keys that collapse distinct credential instances into one entry are the structural defect.

A second, subtler condition: the subset check must run against the parent credential *as embedded in the chain being verified*, not against a re-resolved parent. If the verifier re-resolves the parent from the issuer's current state, it validates a chain that was never presented—a classic time-of-check/time-of-use gap specific to delegated authority.

Decision Boundary

The operational decision is where to draw the cache boundary. Two defensible positions:

The boundary is crossed when a system chooses the second option and the invalidation hook is not wired into every mint site. In practice, any design where scope correctness depends on a developer remembering to invalidate is a design that will launder authority. The guardrail is structural: make the subset check *unable* to see a cached scope, by requiring the parent credential object (not its ID) as the argument to the attenuation function. If the function signature is `attenuate(child_scope, parent_credential: Credential)`, the cache cannot leak in, because the caller must hold the actual bytes.

Operational Effect

Downstream, the widened scope is indistinguishable from a legitimately granted one. Auditors replaying the chain see three valid signatures and a passing subset check at each hop; the only artifact that reveals the widening is the *root task grant*, which lives in the orchestrator's task record, not in the credential chain. This means:

  1. **Forensic gap.** Post-incident reconstruction must join credential-chain logs against task-grant logs to detect the divergence. Neither log alone shows it. Budget for this join in any AAIF audit pipeline.
  2. **Blast radius is bounded by cache TTL, not by policy.** The window during which a narrowed re-issue can be laundered equals the cache lifetime of the wider entry. Short TTLs shrink the window but do not close it; they also impose re-resolution load.
  3. **Revocation does not help.** Revoking the widened child credential after the fact does not un-execute the `net:egress` calls it already authorized. The failure is pre-execution; only prevention at issuance bounds it.

The invariant to enforce, stated as an assertion the runtime must carry: *the scope used to validate any hop must be derivable from the credential bytes of the immediately preceding hop in the presented chain.* The code below encodes the guardrail and the specific exception raised when a re-issuing hop attempts to attenuate against a scope that does not match its parent credential instance.

import hashlib
from dataclasses import dataclass


class ScopeLaunderingError(RuntimeError):
    """Raised when a delegated credential's scope is attenuated against a
    parent scope that does not match the presented parent credential instance.
    Indicates stale scope-cache resolution across a re-issuing hop."""


@dataclass(frozen=True)
class Credential:
    issuer_id: str
    subject_id: str
    scope: frozenset
    body: bytes

    @property
    def instance_hash(self) -> str:
        return hashlib.sha256(self.body).hexdigest()


class ScopeCache:
    """Deliberately keyed by credential instance hash, never by issuer/subject.
    Keying by issuer/subject is the defect this module exists to prevent."""

    def __init__(self):
        self._by_instance = {}

    def resolve(self, cred: Credential) -> frozenset:
        key = cred.instance_hash
        if key not in self._by_instance:
            self._by_instance[key] = cred.scope
        return self._by_instance[key]


def attenuate(child_scope: frozenset, parent: Credential, cache: ScopeCache) -> frozenset:
    """Enforce scope(child) subset-of scope(parent) using the parent credential
    instance actually presented, not a re-resolved or cached-by-issuer view."""
    resolved = cache.resolve(parent)
    if resolved != parent.scope:
        # Cache returned a scope inconsistent with the presented credential bytes.
        raise ScopeLaunderingError(
            f"scope cache diverged from presented parent credential "
            f"{parent.instance_hash[:12]} (issuer={parent.issuer_id}, "
            f"subject={parent.subject_id}): cached={sorted(resolved)} "
            f"actual={sorted(parent.scope)}"
        )
    if not child_scope.issubset(parent.scope):
        raise ScopeLaunderingError(
            f"attenuation violation: child scope {sorted(child_scope)} is not a "
            f"subset of parent scope {sorted(parent.scope)} for credential "
            f"{parent.instance_hash[:12]}"
        )
    return child_scope


def issue_child(parent: Credential, requested: frozenset, cache: ScopeCache) -> frozenset:
    granted = attenuate(requested, parent, cache)
    return granted