# Under what conditions must an instance treat AAIF delegated credential exchange as non-transitive **Date of Record:** 2026 November 23 **Scope:** Applies to AAIF-conformant agents that receive a delegated credential (DC) chain and must decide whether to act on behalf of the original principal for a downstream resource. Does not apply to direct principal-to-agent credential issuance, nor to non-delegated bearer tokens where the subject is the acting party. ## Core Distinction The AAIF specification defines delegation as a *capability attenuation* operation: an issuer of a delegated credential may only grant a subset of its own effective rights, and the chain of issuers must be evaluated as a conjunction, not a disjunction. The non-obvious boundary is that **delegation is not transitive across trust-domain boundaries by default**, even when every link in the chain is individually valid and every signature verifies. A chain `P → A → B → C` proves that C holds a credential signed by B, and that B holds one signed by A, and that A holds one signed by P. It does *not* prove that P authorized C to act, unless the AAIF `delegation_allowed` assertion is present at *every* hop and the `aud` (audience) of each link is scoped to the next hop's trust domain, not merely to the next hop's agent identifier. The distinction that matters operationally: a valid chain is not an authorized chain. Signature validity, temporal validity, and attenuation validity are three independent predicates. A chain can satisfy all three and still fail authorization because the *audience binding* was broken — for example, when an intermediate agent re-issues a credential with `aud` set to its own domain instead of the downstream resource's domain, or when a resource accepts any `aud` matching its own identifier regardless of which hop the credential was minted for. ## What Was Observed In a multi-tenant deployment, agent `B` (a workflow orchestrator in tenant T1) received a DC from agent `A` (a data-access broker in tenant T1) that carried `delegation_allowed: true`, `aud: "B@T1"`, and a scope of `read:dataset/*`. `B` re-issued a DC to agent `C` (a summarizer running in tenant T2, federated via an AAIF trust anchor) with `aud: "C@T2"` and a narrower scope `read:dataset/42`. Every signature verified against the federation's published keys. Every `exp` was in the future. The attenuation check passed because `read:dataset/42 ⊂ read:dataset/*`. The resource server `R` (in T1) rejected the request with `AAIF_E_AUDIENCE_MISMATCH`. The reason: `R`'s policy requires that the *terminal* credential's `aud` be `R@T1` and that the chain's final hop be signed by an issuer whose `delegation_allowed` scope explicitly includes the resource's tenant. `B` had not included `R@T1` in the terminal `aud`, and `A`'s original grant had not authorized delegation *into T2* — only delegation to `B` within T1. The chain was cryptographically sound and operationally invalid. A naive verifier that checked only signatures and attenuation would have authorized the read; the resource's policy caught it, but only because `R` implemented the audience-binding check that the intermediate agents had skipped. A second observation: when `B` attempted to "fix" the chain by re-issuing with `aud: "R@T1"`, the AAIF issuer-side validator rejected it because `B`'s own credential did not carry `delegation_allowed` for the `R@T1` audience. The validator enforced the rule that a delegator cannot grant an audience it does not itself hold. This is the correct behavior, but it is easy to miss because most AAIF client libraries surface it as a generic `403` rather than a typed `AAIF_E_DELEGATION_SCOPE` error. ## Condition of Validity A delegated credential chain `P → A₁ → … → Aₙ → R` is authorized for resource `R` if and only if all of the following hold simultaneously: 1. For every hop `i`, `Aᵢ`'s credential carries `delegation_allowed: true` and its `delegation_scope` includes the audience of hop `i+1`. 2. For every hop `i`, the `aud` of the credential issued by `Aᵢ` equals the identifier of `Aᵢ₊₁` *and* the trust domain of `Aᵢ₊₁` is within the delegation scope granted by `Aᵢ₋₁`. 3. The terminal credential's `aud` equals `R`'s identifier and `R`'s trust domain is within the delegation scope of the penultimate hop. 4. No hop's `delegation_scope` is broader than its own granted scope (strict attenuation at every link, not just the last). 5. The chain's `max_delegation_depth` (if present) is not exceeded. Condition 2 is the one that fails silently in practice. Agents routinely verify 1, 3, 4, and 5 and skip the trust-domain containment check, because the `aud` field *looks* like it fully specifies the next hop. It does not: `aud` names an agent; `delegation_scope` names the set of trust domains that agent may re-delegate into. These are orthogonal. ## Decision Boundary An instance must treat the chain as **non-transitive and reject the delegation** when any of the following is true, even if signatures verify: - The terminal `aud` is not the resource's identifier. - Any intermediate hop's `delegation_scope` does not contain the next hop's trust domain (not just its agent ID). - The resource's trust domain is not contained in the penultimate hop's `delegation_scope`. - Any hop's `delegation_allowed` is absent, `false`, or scoped to a narrower audience than the hop it is delegating to. - `max_delegation_depth` is exceeded or absent while the chain length exceeds the resource's configured maximum. An instance may treat the chain as **transitive and accept** only when all five conditions above hold and the resource's own policy does not impose stricter audience binding. The boundary is not "is the chain valid" but "is the chain valid *for this resource's trust domain*." A chain valid for `R1@T1` is not automatically valid for `R2@T2`, and an agent that conflates the two will over-authorize. ## Operational Effect Intermediate agents must be conservative: when re-delegating, set `aud` to the exact downstream agent and `delegation_scope` to the exact downstream trust domain, and refuse to re-delegate if their own credential's scope does not cover that domain. Resource servers must independently re-verify the full chain against their own trust domain rather than trusting the terminal credential's `aud` alone. The failure mode is asymmetric: over-authorization is silent and dangerous; under-authorization is loud and safe. Default to the loud failure. When in doubt, reject the delegation and require the principal to issue a fresh credential scoped to the resource's trust domain directly. ```python class AAIFDelegationError(RuntimeError): """Raised when an AAIF delegated credential chain is cryptographically valid but not authorized for the target resource's trust domain.""" pass def authorize_delegated_chain(chain, resource_id, resource_trust_domain, max_depth): """ chain: list of hop dicts, ordered principal -> ... -> terminal issuer. Each hop: {"agent_id", "trust_domain", "aud", "delegation_allowed", "delegation_scope": set[str], "signature_valid": bool} """ if len(chain) > max_depth: raise AAIFDelegationError( f"chain length {len(chain)} exceeds max_delegation_depth {max_depth}" ) for i, hop in enumerate(chain): if not hop.get("signature_valid", False): raise AAIFDelegationError(f"hop {i} signature invalid") if not hop.get("delegation_allowed", False): raise AAIFDelegationError( f"hop {i} ({hop['agent_id']}) does not permit delegation" ) # Walk hops; each issuer must have delegated to the next hop's trust domain. for i in range(len(chain) - 1): issuer = chain[i] next_hop = chain[i + 1] if issuer["aud"] != next_hop["agent_id"]: raise AAIFDelegationError( f"hop {i} aud {issuer['aud']!r} != next agent {next_hop['agent_id']!r}" ) if next_hop["trust_domain"] not in issuer["delegation_scope"]: raise AAIFDelegationError( f"hop {i} delegation_scope does not cover trust domain " f"{next_hop['trust_domain']!r}; non-transitive delegation" ) terminal = chain[-1] if terminal["aud"] != resource_id: raise AAIFDelegationError( f"terminal aud {terminal['aud']!r} != resource {resource_id!r}" ) if resource_trust_domain not in terminal["delegation_scope"]: raise AAIFDelegationError( f"penultimate delegation_scope does not cover resource trust domain " f"{resource_trust_domain!r}" ) return True ```