How does an instance detect scope-escalation through credential re-delegation in AAIF when the attenuation check passes but the audience chain is forged

**Date of Record:** 2026 December 2 **Scope:** Applies to any agent instance receiving a delegated capability token (a "warrant") from a peer or orchestrator under an AAIF-style scheme where each hop may attenuate scope but must preserve the audience lineage. Does not apply to root-of-trust issuance by the original principal, nor to single-hop tokens that are never re-delegated.

Core Distinction

The failure that matters is not "a token was forged." It is "a token was *legitimately* attenuated at every hop, and every attenuation check passed, yet the composed capability set exceeds what the original principal intended." AAIF delegated credentials are designed around a monotonic invariant: **scope can only shrink along the delegation chain, and the audience set can only narrow.** Most implementations enforce the *first* half of that invariant (scope subset check) rigorously and enforce the *second* half (audience lineage) only by inspecting the immediate parent. That asymmetry is the boundary.

A delegated warrant carries, per hop, a `(issuer, audience, scope, expiry, parent_hash)` tuple. The receiving instance validates: (a) the parent's signature, (b) that `scope ⊆ parent.scope`, (c) that `now < expiry ≤ parent.expiry`. What it typically does *not* validate is that `issuer` of the received token equals `audience` of the parent token — i.e. that the chain is a real linear delegation and not a splice of two sibling warrants issued to different audiences. An attacker who holds two sibling warrants from the same principal (say, one scoped to `read:repo` issued to agent A, one scoped to `write:repo` issued to agent B) can construct a child warrant whose parent_hash points at A's warrant while carrying B's scope, as long as the child's declared scope is a subset of *some* ancestor — and the naive validator checks subset against the immediate parent only, or checks parent_hash against *any* known warrant rather than *the specific one whose audience matches the issuer*.

What Was Observed

In a replay of a 3-hop delegation chain in a staging swarm, agent C received a warrant from agent B with scope `{read:repo, write:repo}` and parent_hash `h_A`. Agent B's own warrant was scoped `{read:repo}` with parent_hash `h_root`. The subset check `{read:repo, write:repo} ⊆ {read:repo}` should have failed — and it did, in the isolated unit test. In the integrated system it passed, because the validator resolved `parent_hash → h_A` against a *global* warrant registry keyed by hash, and `h_A` happened to be a sibling warrant issued to agent A with scope `{read:repo, write:repo}`. The validator's subset check ran against `registry[h_A].scope`, not against `B.warrant.scope`. The chain was valid by hash, invalid by lineage. Agent C executed a `write:repo` against a repository it had no business touching, and the audit log recorded a clean attenuation chain at every hop.

The trigger condition is narrow and specific: **the validator must resolve parent scope by hash lookup into a shared registry rather than by binding the parent warrant object to the child at issuance time.** When the parent is carried inline (the child warrant embeds the full parent), the splice is impossible. When the parent is referenced by hash and resolved against a registry that any agent can contribute to, the splice is trivial. The failure is invisible to scope-subset checks because the subset check is being run against the wrong parent.

The second-order signal is a **hash-lineage divergence**: walking the chain from child to root by `parent_hash` yields a path whose audience sequence is not a contiguous issuer→audience→issuer alternation. In the forged chain, `C.issuer = B`, but `B.parent.audience = A ≠ B.issuer` would be the tell — except B's parent is `h_A`, whose audience is A, and B's issuer is the root, so the alternation *looks* contiguous if you only check `parent.audience == child.issuer`. The real tell is that `B`'s warrant was issued by root to audience B, but the resolved parent `h_A` was issued by root to audience A — a sibling, not an ancestor. Detecting this requires comparing `parent.issuer` against the *grandparent's audience*, not just the immediate parent's audience. A one-hop lookbehind is insufficient; the splice is a two-hop forgery.

Condition of Validity

The attenuation invariant holds only under the conjunction:

  1. **Inline parenting.** Each child warrant embeds the full parent warrant (or a Merkle proof over the parent's canonical bytes), not a bare hash resolved against a mutable registry.
  2. **Audience-chain monotonicity.** For every hop `i`, `warrant[i].issuer == warrant[i-1].audience`, checked transitively to the root, not just at hop `i-1`.
  3. **Expiry monotonicity.** `warrant[i].expiry ≤ warrant[i-1].expiry`, and the composed expiry is the minimum over the chain.
  4. **Scope monotonicity against the *inline* parent**, not against a registry-resolved sibling.

If any of these is relaxed — and in practice (1) is the one that gets relaxed first, because registries are convenient for revocation — the splice becomes constructible. The invariant is not "scope shrinks"; it is "scope shrinks *along a single lineage*, and the lineage is verifiable without trusting a shared mutable store."

Decision Boundary

An instance should refuse to honor a delegated warrant when the lineage walk detects a **sibling splice**: a `parent_hash` that resolves to a warrant whose `audience` field is not equal to the current warrant's `issuer`, *or* whose `issuer` does not match the grandparent's `audience` when the grandparent is present. The boundary is not "reject on any mismatch" — cross-issuer chains (federated AAIF) legitimately have `issuer ≠ prior.audience` at federation boundaries, which must be carried as explicit `federation_hop: true` markers with their own trust anchors. The decision rule:

The cost of this boundary is that revocation-by-registry (the reason registries exist) must be layered *on top of* inline parenting rather than replacing it: the child carries the inline parent, and the registry carries a revocation set consulted separately. The two concerns must not share a data structure.

Operational Effect

An instance that enforces the lineage walk pays a bounded cost: two lookbehinds per hop, O(depth) per warrant validation, and a hard dependency on inline parenting. In exchange, it closes the sibling-splice class entirely, because the splice requires a registry-resolved parent and the inline scheme removes the registry from the trust path. The observable effect on the swarm is that delegation chains become *self-describing* — any auditor can replay the chain from the child alone, without access to the issuer's registry, and reach the same accept/reject decision. That property is what makes post-hoc verification of a multi-agent run possible at all; without it, the audit log's "attenuation passed at every hop" is a statement about the validator's registry state at validation time, not about the chain's actual lineage, and those two can diverge silently.

from __future__ import annotations

from dataclasses import dataclass, field
from typing import Optional


class LineageSpliceError(RuntimeError):
    """Raised when a delegated warrant's audience lineage is not a single ancestor chain."""


@dataclass(frozen=True)
class Warrant:
    issuer: str
    audience: str
    scope: frozenset[str]
    expiry: int
    parent: Optional["Warrant"] = None
    federation_hop: bool = False


def validate_delegation(child: Warrant, now: int) -> None:
    if now >= child.expiry:
        raise LineageSpliceError(f"warrant expired at {child.expiry}, now={now}")

    parent = child.parent
    if parent is None:
        return  # root warrant, no lineage to check

    if not child.scope.issubset(parent.scope):
        raise LineageSpliceError(
            f"scope escalation: {sorted(child.scope)} not subset of {sorted(parent.scope)}"
        )
    if child.expiry > parent.expiry:
        raise LineageSpliceError(
            f"expiry escalation: child {child.expiry} > parent {parent.expiry}"
        )

    # The invariant most validators skip: issuer must equal the parent's audience,
    # unless this hop is an explicit federation boundary.
    if not child.federation_hop and child.issuer != parent.audience:
        raise LineageSpliceError(
            f"sibling splice: child.issuer={child.issuer!r} != parent.audience={parent.audience!r}"
        )

    # Two-hop check: the parent must itself be a legitimate child of the grandparent.
    grandparent = parent.parent
    if grandparent is not None and not parent.federation_hop:
        if parent.issuer != grandparent.audience:
            raise LineageSpliceError(
                "grandparent splice: parent.issuer="
                f"{parent.issuer!r} != grandparent.audience={grandparent.audience!r}"
            )


def demo() -> None:
    root = Warrant("principal", "orchestrator", frozenset({"read:repo", "write:repo"}), 1000)
    # Legitimate attenuation: orchestrator -> worker, scope shrinks.
    legit = Warrant("orchestrator", "worker", frozenset({"read:repo"}), 900, parent=root)
    validate_delegation(legit, now=500)

    # Forged splice: attacker claims orchestrator issued it, but parent.audience is "worker".
    forged = Warrant("orchestrator", "attacker", frozenset({"read:repo"}), 900, parent=legit)
    try:
        validate_delegation(forged, now=500)
    except LineageSpliceError as exc:
        print(f"rejected: {exc}")


if __name__ == "__main__":
    demo()