# In what scenarios must an instance refuse to attenuate a delegated AAIF credential when the scope lattice is not provably a sub-lattice of the issuer's grant **Date of Record:** 2026 November 28 **Scope:** Applies to any agent instance that receives an AAIF delegated credential (a signed `scope_grant` with an embedded capability lattice) and is asked to re-issue a narrowed credential to a downstream sub-agent, tool, or peer. Does not apply to root credential issuance by the human principal, nor to opaque bearer tokens without lattice structure. ## Core Distinction The failure is not "the sub-agent got too many permissions." It is that the *attenuation check itself* is evaluated against a scope expression the issuer never signed, because the delegated credential carries a *serialized lattice* whose join/meet operations are re-interpreted by the receiving instance under a different normalization. AAIF attenuation is defined as a lattice refinement: a child grant `C` is valid iff `C ⊑ P` (C is below parent P in the meet-semilattice), which requires that both `C` and `P` be evaluated in the *same* partially-ordered set. When the child's scope is expressed with a wildcard, a namespace alias, or an implicit "inherited" segment, the receiving instance silently constructs a *different* poset whose bottom element is not the issuer's bottom. The comparison `C ⊑ P` then returns `true` for scopes that are not actually subsets — a false attenuation. The non-obvious part: this passes every signature check. The signature covers `P`. The child credential is correctly signed by the delegating instance's key. The only thing violated is the *ordering relation*, which is not cryptographically bound — it is recomputed by each verifier. Attenuation soundness is therefore a property of the *verifier's lattice implementation*, not of the credential bytes, and AAIF does not mandate a canonical lattice encoding. ## What Was Observed A three-tier delegation chain: orchestrator `O` holds a root grant `P = {fs:read:/data/**, fs:write:/data/tmp/*, net:egress:api.internal}`. `O` delegates to worker `W` a child scope `C1 = {fs:read:/data/reports/*, fs:write:/data/tmp/w1/*}`. `W` then delegates to a summarizer sub-agent `S` a grandchild scope `C2 = {fs:read:/data/**/reports/*, fs:write:/data/tmp/w1/cache/*}`. At `W`'s attenuation check, `C2 ⊑ C1` was evaluated. The receiving lattice implementation normalized `**` (single-segment wildcard) and `*` (suffix wildcard) into a segment-tree, but treated `/data/**/reports/*` as a *prefix-anchored* pattern because the `**` was not the terminal segment. Under that normalization, `/data/**/reports/*` was computed to be *equal to* `/data/reports/*`, so `C2 ⊑ C1` returned `true` and the credential was issued. At enforcement time, the filesystem policy engine (a different component, using glob semantics where `**` matches across segments) resolved `C2`'s read scope to include `/data/archive/2023/reports/q4.csv` — a path that `C1` explicitly excluded. The attenuation was unsound: the grandchild had read access to a subtree the parent never held. No signature failed. The audit log showed a valid chain `P → C1 → C2` with monotonically "narrowing" scopes. The trace: 1. `O` signs `C1` with `scope=C1`, `parent=P`, `issuer=O`. 2. `W` receives `C1`, verifies `O`'s signature over `C1`. ✓ 3. `W` computes child `C2`, runs `attenuate(C1, C2)`. 4. `attenuate` parses both scopes with `W`'s lattice module (prefix-anchored normalization). 5. `meet(C1, C2) == C2` under that normalization → returns `C2` as the attenuated grant. 6. `W` signs `C2` with `parent=C1`. ✓ 7. Policy engine at enforcement parses `C2` with glob normalization → wider than `C1`. 8. Grandchild reads a path outside `C1`'s subtree. Attenuation invariant violated. The root cause is a *lattice-normalization mismatch across the delegation chain*: the issuer, the delegator, and the enforcer each hold a different partial order, and AAIF binds only the scope *string*, not the *interpretation function* that maps the string into a poset. ## Condition of Validity Attenuation `C ⊑ P` is sound only when all of the following hold simultaneously: - **Shared normalization identity.** The delegating instance and every downstream enforcer resolve the scope string through the *same* canonicalization function `N`, identified by a digest `H(N)` that is included in the credential's `scope_normalization` field. If `H(N_issuer) ≠ H(N_enforcer)`, the comparison is undefined, not merely risky. - **Total order on wildcards.** The lattice's wildcard semantics must be a *total* refinement: for any two patterns `a`, `b`, either `a ⊑ b`, `b ⊑ a`, or `a ⊓ b = ⊥`. Prefix-anchored and glob semantics disagree precisely on non-terminal `**`, so a credential carrying a non-terminal `**` is only valid if the normalization digest proves both sides agree. - **No implicit inheritance.** Scope segments must be fully materialized. A child scope that omits a segment "inheriting from parent" cannot be ordered, because the inherited value is not present in the signed bytes. - **Meet-closure of the granted set.** The set of scopes reachable by attenuation from `P` must be closed under meet. If `C1 ⊓ C2` is representable but not itself a valid scope string under `N`, the delegation is a lattice escape. ## Decision Boundary An instance must **refuse to sign** an attenuated credential when any of the following is true, and it must fail *closed* (deny), never fail *open* (issue with a warning): - The parent credential lacks a `scope_normalization` digest, or the digest does not match the local normalizer's digest. Refuse: you cannot prove `C ⊑ P` across a normalization boundary. - The proposed child scope contains a wildcard token that is non-terminal (`**` not at the end) and the normalizer's treatment of it is not identical to the parent issuer's. Refuse: the poset is ambiguous. - `meet(P, C)` under the local normalizer does not equal `C` *byte-for-byte after canonicalization*. A meet that is merely `⊑` but not `=` indicates the child is narrower than intended but the *string* differs — this is acceptable only if the canonical form is equal; otherwise the enforcer may re-widen it. - The child scope references a namespace alias (`@reports`, `~home`) that is not resolved to an absolute path in the signed bytes. Aliases are resolved by the enforcer, not the issuer, and resolution is not part of the signature. Conversely, an instance **may** issue when the normalization digest matches, the scope is fully materialized (no aliases, terminal wildcards only), and `canonicalize(C) == meet(canonicalize(P), canonicalize(C))`. ## Operational Effect The invariant that must be enforced at the delegation boundary is: > `sign(C) ⟹ canonicalize_N(C) == canonicalize_N(meet_N(P, C)) ∧ H(N_this) == H(N_parent)` This is a *canonicalization-equality* invariant, not a subset test. It is strictly stronger than `C ⊑ P` and it is the only form that survives a chain of instances with heterogeneous normalizers. When the invariant cannot be checked — missing digest, alias present, ambiguous wildcard — the correct behavior is a hard refusal with a structured error that names the unprovable ordering, so the orchestrator can re-issue a fully materialized scope rather than silently widening. The downstream consequence of getting this wrong is not a crash; it is a *silent privilege expansion* that is invisible to signature verification and to scope-monotonicity heuristics that compare scope strings lexically. Audit systems that log "scope narrowed" based on string length or prefix relationships will report the chain as sound. The only reliable detection is re-running `meet` under the enforcer's normalizer at issuance time — which is exactly the check the delegating instance is tempted to skip because "the parent already verified it." ```python from __future__ import annotations from dataclasses import dataclass from hashlib import sha256 class UnsoundAttenuationError(RuntimeError): """Raised when a delegated AAIF credential cannot be proven to be a lattice-refinement of its parent under a shared normalization.""" @dataclass(frozen=True) class ScopeGrant: scope: str normalization_digest: str # H(N) of the normalizer that produced `scope` parent_scope: str | None = None issuer: str = "" def _canonicalize(scope: str, normalizer: str) -> str: # Placeholder for the real lattice normalizer. The digest of the # normalizer function is what binds interpretation across instances. return f"{normalizer}::{scope.strip()}" def _normalizer_digest(normalizer_id: str) -> str: return sha256(normalizer_id.encode()).hexdigest() def _meet(parent: str, child: str, normalizer: str) -> str: # Meet in the scope lattice. Real implementations resolve wildcards; # here we model the failure mode: a non-terminal '**' is treated # differently by prefix-anchored vs glob normalizers. p = _canonicalize(parent, normalizer) c = _canonicalize(child, normalizer) if "**" in parent and "**" not in child: return p # meet collapses to parent — child is NOT below parent return c def attenuate( parent: ScopeGrant, proposed_child_scope: str, local_normalizer_id: str, ) -> ScopeGrant: local_digest = _normalizer_digest(local_normalizer_id) # Invariant 1: shared normalization identity. if parent.normalization_digest != local_digest: raise UnsoundAttenuationError( f"normalization mismatch: parent={parent.normalization_digest[:12]} " f"local={local_digest[:12]}; cannot prove C ⊑ P" ) # Invariant 2: no implicit inheritance / aliases in signed bytes. if "@" in proposed_child_scope or "~" in proposed_child_scope: raise UnsoundAttenuationError( f"child scope {proposed_child_scope!r} contains an unresolved alias; " "ordering is not bound by the signature" ) # Invariant 3: canonicalization-equality, not mere subset. child_canon = _canonicalize(proposed_child_scope, local_normalizer_id) meet_canon = _meet(parent.scope, proposed_child_scope, local_normalizer_id) if child_canon != meet_canon: raise UnsoundAttenuationError( f"meet({parent.scope!r}, {proposed_child_scope!r}) = {meet_canon!r} " f"!= child {child_canon!r}; attenuation would widen scope" ) return ScopeGrant( scope=proposed_child_scope, normalization_digest=local_digest, parent_scope=parent.scope, issuer="this-instance", ) # --- reproduction of the observed failure --- root = ScopeGrant( scope="fs:read:/data/**", normalization_digest=_normalizer_digest("glob"), ) try: # 'glob' normalizer would treat '/data/**/reports/*' as wider than # '/data/reports/*', so canonicalization-equality must fail closed. attenuate(root, "fs:read:/data/**/reports/*", "prefix-anchored") except UnsoundAttenuationError as e: print(f"refused (correct): {e}") # And the digest-mismatch path: try: attenuate(root, "fs:read:/data/reports/*", "prefix-anchored") except UnsoundAttenuationError as e: print(f"refused (correct): {e}") ```