What happens when an instance re-scopes a delegated capability token mid-chain: attenuation-graph aliasing and the silent privilege-laundering failure

**Date of Record:** 2026 December 1 **Scope:** Applies to AAIF-style delegated credential chains where an orchestrator mints a scoped capability token, delegates a strictly-attenuated subset to a sub-agent, and that sub-agent further re-scopes per tool call. Does not apply to single-hop bearer tokens or to static RBAC grants where no attenuation edge exists.

Core Distinction

The distinction that matters is between **token identity** (a cryptographic handle that names a grant) and **capability scope** (the concrete set of resources, verbs, and constraints that the grant actually authorizes). AAIF chains are designed so that delegation *attenuates*: child scope ⊆ parent scope, monotonic decreasing. The invariant is a lattice-subset property, not a string-equality property.

The failure mode is not "forged token" or "expired token." It is **scope aliasing**: a sub-agent re-scopes a delegated token for a downstream tool call in a way that is *set-theoretically a subset of the parent when each dimension is checked independently, but not a subset of the parent's joint constraint set*. Independent per-dimension subset checks pass; the joint product does not. The child token is therefore valid-looking, signature-valid, chain-valid — and over-privileged relative to the true parent grant. This is privilege laundering through a dimension-crossing attenuation edge, and it is invisible to any validator that checks dimensions in isolation.

What Was Observed

An orchestrator `A` held a delegated credential `T0` scoped to `{resource: /data/*, verb: read, region: {us-east, us-west}}`. It delegated to planner agent `B` a token `T1` scoped to `{resource: /data/reports/*, verb: read, region: {us-east}}` — a clean attenuation. `B` then needed to call a summarizer tool and re-scoped to `T2`:

A per-dimension validator that checked resource and verb *first* and returned early on the first failure-free pass, or that validated each dimension against the *root* `T0` rather than the immediate parent `T1`, admitted `T2`. The tool executed a `read` of `/data/reports/q3/*` against `eu-west` storage — a region the orchestrator had explicitly excluded from `T1` for data-residency reasons.

The trace that exposed it: the downstream tool's audit log recorded a valid, chain-verified `T2` with a `region` value that did not appear anywhere in `T1`'s serialized scope. The signature was valid because `B` legitimately held the signing key for its own child tokens. The chain was valid because the chain-walker verified signatures and *presence* of attenuation claims, not the *joint* subset relation.

A subtler variant surfaced when a retry loop re-issued `T2'` after a timeout: the re-scope logic read the *original* `T0` scope from the agent's cached memory of its grant (stale by one hop), not `T1` from the live token. The child token was then attenuated against the wrong parent — a **parent-pointer aliasing** bug where the attenuation base was a stale in-context copy of an ancestor rather than the immediate delegating token.

Condition of Validity

The attenuation invariant holds **if and only if** every child scope is verified as a *joint* subset of its immediate parent across the full constraint product, and the parent used for that check is the *live, signed* parent token — never a reconstructed or cached scope.

Formally: for child `Tc` and immediate parent `Tp`, require `Tc.scope ⊑ Tp.scope` where `⊑` is the product-lattice order over `(resource-set × verb-set × region-set × constraint-predicates)`, and where any dimension absent from `Tc` inherits `Tp`'s *most restrictive* value, not the root's. The check must be:

  1. **Joint, not per-dimension.** Compute the intersection of all dimensions and confirm `Tc ⊆ (Tp.resource × Tp.verb × Tp.region × …)`. A tuple `(r, v, g)` in `Tc` must have `r ∈ Tp.resource ∧ v ∈ Tp.verb ∧ g ∈ Tp.region` *simultaneously*.
  2. **Parent-anchored.** The parent reference must resolve to the signed `Tp` fetched from the chain store, and its `scope_hash` must match the `parent_scope_hash` embedded in `Tc`. If the agent's working memory holds a scope that disagrees with the live parent, the token is invalid regardless of signature.
  3. **Default-deny on missing dimensions.** A child that omits `region` does not inherit "all regions"; it inherits `Tp.region`. Omission is narrowing-by-inheritance, never widening.

When any of these three is relaxed — early-return per-dimension checks, root-anchored attenuation, or omission-as-wildcard — the invariant is void and the chain admits privilege laundering.

Decision Boundary

The boundary is between **accepting a child token because it is a subset along every dimension checked independently** and **accepting it because it is a subset of the joint product anchored to the live immediate parent**. The first is the failure; the second is the guardrail.

Concretely, a validator must reject `Tc` when:

The boundary is sharp: **per-dimension subset checks are necessary but not sufficient; joint subset against the live immediate parent is both.** Any implementation that short-circuits on the first dimension, or that anchors to the root, sits on the wrong side.

Operational Effect

Downstream of the failure: a tool call executes with a capability the delegating agent never granted, in a region or resource class excluded by policy. The audit trail shows a cryptographically valid chain, so post-hoc forensics attribute the action to the sub-agent's legitimate authority — the laundering is *attributed*, not *detected*. Data-residency, tenancy, and rate-class constraints that were enforced at `T1` silently evaporate at `T2`.

The corrective is architectural, not procedural: (1) the attenuation validator must compute the joint product subset against the live signed parent and hard-fail on any component widening; (2) child tokens must embed `parent_scope_hash` and the validator must recompute it from the chain store, never from agent working memory; (3) omitted dimensions must be materialized from the parent before validation so omission can never be read as wildcard; (4) the tool executor must independently re-verify the joint subset at call time, because a sub-agent's own validator is exactly the component that was compromised by stale memory.

The residual risk after these guards is the *signing-key* trust boundary: a sub-agent that legitimately holds its own child-signing key can still mint a token whose `parent_scope_hash` matches a parent it fetched, so the guard depends on the chain store serving the *immediate* parent and on `parent_scope_hash` being bound into the signature. If the parent pointer is not signed into the child, a sub-agent can alias any ancestor it can read.

import hashlib
from dataclasses import dataclass, field


class AttenuationViolation(RuntimeError):
    """Raised when a delegated child token is not a joint subset of its live parent."""
    pass


class StaleParentAlias(AttenuationViolation):
    """Raised when a child token was attenuated against a cached/ancestor scope, not the live parent."""
    pass


@dataclass(frozen=True)
class Scope:
    resource: frozenset
    verb: frozenset
    region: frozenset

    def scope_hash(self) -> str:
        payload = "|".join([
            ",".join(sorted(self.resource)),
            ",".join(sorted(self.verb)),
            ",".join(sorted(self.region)),
        ])
        return hashlib.sha256(payload.encode()).hexdigest()


@dataclass(frozen=True)
class CapabilityToken:
    token_id: str
    scope: Scope
    parent_scope_hash: str


def _materialize(child: Scope, parent: Scope) -> Scope:
    # Omission inherits the parent's most restrictive value, never wildcard.
    return Scope(
        resource=child.resource if child.resource else parent.resource,
        verb=child.verb if child.verb else parent.verb,
        region=child.region if child.region else parent.region,
    )


def verify_attenuation(child: CapabilityToken, live_parent: CapabilityToken, chain_store: dict) -> None:
    # 1. Parent must be the live signed token from the chain store, not a cached copy.
    stored = chain_store.get(live_parent.token_id)
    if stored is None or stored.scope.scope_hash() != live_parent.scope.scope_hash():
        raise StaleParentAlias(
            f"parent {live_parent.token_id} not resolvable to live signed scope in chain store"
        )

    # 2. Child must be bound to this exact parent scope.
    if child.parent_scope_hash != live_parent.scope.scope_hash():
        raise StaleParentAlias(
            f"child {child.token_id} attenuated against scope hash "
            f"{child.parent_scope_hash[:12]}, live parent is "
            f"{live_parent.scope.scope_hash()[:12]}"
        )

    # 3. Joint subset check across the full constraint product.
    effective = _materialize(child.scope, live_parent.scope)
    for dim in ("resource", "verb", "region"):
        child_set = getattr(effective, dim)
        parent_set = getattr(live_parent.scope, dim)
        widened = child_set - parent_set
        if widened:
            raise AttenuationViolation(
                f"child {child.token_id} widens dimension '{dim}' "
                f"beyond parent {live_parent.token_id}: {sorted(widened)}"
            )


def delegate(orch: CapabilityToken, child_id: str, requested: Scope,
             chain_store: dict) -> CapabilityToken:
    token = CapabilityToken(
        token_id=child_id,
        scope=requested,
        parent_scope_hash=orch.scope.scope_hash(),
    )
    verify_attenuation(token, orch, chain_store)
    chain_store[child_id] = token
    return token