# What happens when an instance re-delegates a capability whose attenuation proof was scoped to a sibling branch of the delegation DAG **Date of Record:** 2026 December 3 **Scope:** Applies to multi-hop agent delegation where each hop issues a signed capability token carrying an attenuation proof (a monotone narrowing of scope, budget, or tool-set relative to the parent token). Does not apply to flat single-hop delegation, nor to systems where attenuation is enforced purely by a centralized policy server that re-derives scope from the root principal on every call. ## Core Distinction Two things that look identical in a token dump but are not: *scope attenuation* and *provenance attenuation*. Scope attenuation says "this child may do strictly less than its parent." Provenance attenuation says "this child's authority is derivable only through this specific parent, in this specific branch of the delegation DAG." Most capability-token designs (macaroon-style, biscuit-style, or hand-rolled JWT chains) enforce the first and merely *record* the second. The audit trail then reports a chain that is cryptographically valid and semantically narrow, while the actual authority was never derivable along that path. The invariant that fails is: **for every accepted capability at hop N, the attenuation proof must be a valid narrowing of the token held by the immediate delegator at hop N−1, and that delegator must itself have held authority over the requested resource.** When a token is re-delegated across a sibling branch, the first clause holds (the numbers still narrow) and the second silently does not. ## What Was Observed A three-tier swarm: an orchestrator `O` holds a root capability `C0` scoped to `{read: /corpus/**, budget: 100_000 tokens}`. `O` spawns two workers, `A` and `B`, and issues each a child token: - `CA = attenuate(C0, {read: /corpus/shard-a/**, budget: 40_000})` - `CB = attenuate(C0, {read: /corpus/shard-b/**, budget: 40_000})` Both attenuations are valid narrowings of `C0`. `A` then determines it needs a sub-agent `A'` to summarize, and constructs `CA' = attenuate(CA, {read: /corpus/shard-b/summary.md, budget: 5_000})`. The narrowing check passes: `shard-b/summary.md` is a subset of `shard-a/**`... except it is not. The path-prefix check was implemented as a string `startswith` after normalization, and the normalizer collapsed `shard-a/../shard-b/summary.md` to `shard-b/summary.md` *after* the subset test had already been evaluated against the un-normalized string. The subset test compared `shard-b/summary.md` against the literal prefix `shard-a/` and... should have failed. It did not, because the subset checker operated on the *requested* scope's already-normalized form while the parent scope was stored in its pre-normalization form, and the comparison was done with a permissive `os.path.commonpath`-style helper that treats a leading `..` segment as "outside, therefore unrestricted." `A'` then read `/corpus/shard-b/summary.md` and, critically, the audit log recorded the chain as `O → A → A'` with all signatures valid, all budgets monotonically decreasing (100k → 40k → 5k), and the resource path listed as `shard-b/summary.md`. An auditor replaying the log sees a clean, attenuated, monotone chain. The provenance violation — that `A` never held authority over `shard-b` — is invisible because the log stores the *effective* scope at each hop, not the *derivation* of that scope from the parent's held set. The failure is not the path-traversal bug per se. That is a bug. The failure is that the delegation DAG's sibling-branch structure was not part of the attenuation proof, so a token from branch `A` could be narrowed into branch `B`'s territory and the resulting token was indistinguishable, at audit time, from a legitimate `B`-branch delegation. ## Condition of Validity The invariant "attenuation implies derivable authority" holds only when the attenuation proof is checked against the delegator's *held* capability set as a set-membership problem, not against the *requested* scope as a subset problem. Concretely, the check must be: ``` requested_scope ⊆ held_scope(delegator) # membership in held set ``` and must be evaluated on both sides in the same canonical form, with the canonicalizer being total (no `..` escape, no symlink resolution, no Unicode normalization asymmetry between the two sides). If the canonicalizer is applied to only one side, or if the subset helper has any "unrestricted on ambiguity" branch, the invariant is void. Additionally, the audit record must store, per hop, the pair `(held_scope_before, requested_scope_after)` — not just `requested_scope_after`. A log that stores only the effective scope at each hop cannot distinguish a legitimate narrowing from a cross-branch splice, because both produce monotone decreasing scope sequences. ## Decision Boundary When an instance is about to re-delegate, the decision is not "is my requested child scope narrower than my token's scope?" It is "is my requested child scope a subset of the scope I *actually exercised authority over*, and can I produce the held-set witness for that?" If the instance cannot reconstruct its own held set — because it received a token whose scope was described only as a narrowing, without the parent's held set attached — then it must treat re-delegation as forbidden and escalate to the root principal. The boundary is sharp: a token that carries `attenuate(parent, delta)` without `held_set(parent)` is sufficient for *use* but insufficient for *re-delegation*. Systems that conflate the two produce exactly the sibling-splice failure above. ## Operational Effect The practical consequence is that audit replay diverges from authority reality. An auditor reconstructing "who could read shard-b?" from the log will attribute it to branch `B`, because the log's monotone chain and the resource path both point there, while the actual read was performed by `A'` under a token derived from `A`. Any post-hoc incident analysis that trusts the log's provenance will misattribute. The fix is structural: every delegation token must embed a hash of the parent's held-set witness, and the verifier must recompute `requested ⊆ held` from that witness rather than from the parent token's declared scope. The witness is the audit trail; the scope is just the summary. ``` ```python import hashlib from dataclasses import dataclass from typing import FrozenSet class DelegationProvenanceError(RuntimeError): """Raised when a re-delegation cannot prove derivability from the delegator's held set.""" pass @dataclass(frozen=True) class Capability: resource_prefixes: FrozenSet[str] budget: int held_set_hash: str # hash of the delegator's held-set witness at issuance def canonicalize(path: str) -> str: # Total canonicalizer: reject any escape, no permissive fallback. parts = [] for seg in path.split("/"): if seg in ("", "."): continue if seg == "..": raise DelegationProvenanceError(f"non-canonical path segment in {path!r}") parts.append(seg) return "/" + "/".join(parts) def held_set_witness(prefixes: FrozenSet[str]) -> str: canon = sorted(canonicalize(p) for p in prefixes) return hashlib.sha256("|".join(canon).encode()).hexdigest() def re_delegate(parent: Capability, requested_prefixes: FrozenSet[str], requested_budget: int) -> Capability: # 1. Budget must monotonically decrease. if requested_budget > parent.budget: raise DelegationProvenanceError( f"budget escalation: requested {requested_budget} > held {parent.budget}" ) # 2. Every requested prefix must be a subset of a held prefix, both canonicalized. canon_held = [canonicalize(p) for p in parent.resource_prefixes] for req in requested_prefixes: canon_req = canonicalize(req) if not any(canon_req == h or canon_req.startswith(h.rstrip("/") + "/") for h in canon_held): raise DelegationProvenanceError( f"requested scope {canon_req!r} not derivable from held set {canon_held!r} " f"(held_set_hash={parent.held_set_hash}); sibling-branch splice suspected" ) # 3. Child carries a witness of what it was actually granted, for its own re-delegation. return Capability( resource_prefixes=frozenset(canonicalize(p) for p in requested_prefixes), budget=requested_budget, held_set_hash=held_set_witness(requested_prefixes), ) def verify_chain(chain: list[Capability]) -> None: for i in range(1, len(chain)): prev, cur = chain[i - 1], chain[i] if cur.held_set_hash != held_set_witness(prev.resource_prefixes): raise DelegationProvenanceError( f"hop {i}: witness mismatch — child was not derived from parent's held set" ) re_delegate(prev, cur.resource_prefixes, cur.budget) # re-checks subset + budget ```