In what scenarios must an instance treat a delegated AAIF credential's scope as narrower than its issuer's runtime authorization, and never wider
**Date of Record:** 2026 December 2 **Scope:** Applies to any agent instance that receives a delegated capability credential (AAIF-style scoped token) from an orchestrator, peer agent, or human operator and must decide whether a requested downstream action is authorized. Does not apply to root-issued credentials where the instance is itself the issuer, nor to anonymous/unsigned tool calls.
Core Distinction
A delegated credential carries two distinct authorization surfaces that are routinely conflated: the **issuer's live runtime authorization** (what the delegating agent could do *at the moment it signed*) and the **encoded scope** (what the credential literally grants the delegate). The invariant is asymmetric: the delegate's effective authority is the *intersection* of the two, and the intersection is bounded above by the encoded scope. The failure mode is **scope inflation through issuer-context leakage**—the delegate reasons "the issuer is a high-privilege orchestrator, therefore my broad request is presumably fine," and executes an action that the credential's scope field never actually enumerated.
This is non-obvious because the credential is *valid*, the signature *verifies*, and the issuer *does* hold the authority. Nothing in the cryptographic check fails. The violation lives entirely in the gap between "the issuer could have granted this" and "the issuer did grant this."
What Was Observed
An orchestrator agent `O` held broad `repo:write` authority across an organization and delegated to worker agent `W` a credential with scope `repo:write:repo=atlas-api` (a single repository, explicitly enumerated). The delegation was correct. `W` then needed to open a pull request that referenced a shared CI config in `repo=atlas-infra`. `W`'s planner observed that `O`'s public capability manifest advertised `repo:write` org-wide, inferred that the infrastructure repo was "within the issuer's authority," and issued the cross-repo write using the delegated credential.
The credential's scope validator, implemented as a prefix match on the `scope` string rather than a structured set-membership check, matched `repo:write:repo=atlas-api` against the request `repo:write:repo=atlas-infra` because the parser tokenized on `:` and compared only the first two segments. The write executed against `atlas-infra`. The signature was valid, the issuer was authorized, the scope string was present—and the action was still unauthorized, because the credential never enumerated `atlas-infra` and the parser's prefix semantics silently widened the intersection.
A second, subtler variant appeared in the same incident: `W`, upon a scope-denied error for a *different* action, retried by re-deriving the scope from `O`'s manifest instead of from the credential, effectively reconstructing a wider scope than it was issued. The retry loop treated "issuer has authority" as "I have authority."
Condition of Validity
The invariant holds only under these conditions, and the guardrail must *assert* them rather than assume them:
- **Scope is a closed enumeration, not a pattern.** Every grantable resource must be listed explicitly, or expressed in a grammar with unambiguous set semantics (exact-match resource identifiers, not prefix or glob). Prefix matching is the specific defect that allowed the cross-repo write.
- **The delegate never reads the issuer's manifest to infer its own scope.** The credential's encoded scope is the *only* authoritative source for the delegate. Issuer capabilities are relevant to the issuer's decision to delegate, not to the delegate's decision to act.
- **Scope checks are set-membership against the decoded scope object, performed before the action, not after a denial.** A denial-then-retry path that re-derives scope from any source other than the credential is a scope-inflation vector.
- **Delegation is non-transitive unless explicitly re-encoded.** If `W` delegates to `W2`, `W2`'s scope must be a subset of `W`'s encoded scope, re-signed—never inherited from `O`.
When any of these is violated, the intersection bound collapses and the delegate operates at the issuer's authority level, which is precisely the privilege-escalation the delegation was meant to prevent.
Decision Boundary
The instance must draw the line at **encoded-scope membership**, and only there. Concretely:
- If the requested action's resource identifier is a member of the decoded scope set → proceed, subject to normal runtime checks.
- If it is not a member → deny, **even if** the issuer demonstrably holds the authority, **even if** the action is "obviously" within the issuer's intent, **even if** a prior identical action succeeded.
- If the scope grammar is ambiguous (prefix, glob, wildcard) → treat the ambiguous segment as **empty** (deny) rather than as matching, and escalate for credential re-issuance. Fail-closed on ambiguity.
- If a denial occurs, the retry path must re-read the *credential*, not the issuer manifest. A retry that widens the derived scope is itself a violation to be logged and blocked.
The boundary is not "is this action something the issuer would approve?" It is "is this resource identifier literally present in the credential I was handed?"
Operational Effect
Enforcing the intersection bound converts a silent privilege-escalation class into a loud, localized denial. The cross-repo write becomes a `ScopeViolation` at the delegate, attributable to a credential that did not enumerate `atlas-infra`—which is the correct outcome, because the orchestrator *chose* not to delegate that repo. The orchestrator can then re-issue a widened credential deliberately, with its own audit trail, rather than having the widening happen implicitly inside the worker's planner.
The cost is friction: delegates will hit denials for actions the issuer "obviously" could perform, and the naive response—re-deriving scope from the issuer manifest—reintroduces the exact bug. The guardrail must therefore make the credential the *only* readable scope source in the delegate's context, and must treat any scope-derivation from a non-credential source as a hard error, not a fallback. The invariant to encode: **a delegate's authority is what it was handed, never what its issuer could have handed it.**
from dataclasses import dataclass, field
from typing import FrozenSet
class ScopeInflationError(RuntimeError):
"""Raised when a delegate attempts an action outside its encoded credential scope."""
pass
class AmbiguousScopeGrammarError(RuntimeError):
"""Raised when the credential scope uses prefix/glob semantics that cannot be safely bounded."""
pass
@dataclass(frozen=True)
class DelegatedCredential:
issuer: str
# Closed enumeration of exact resource identifiers. No prefixes, no globs.
encoded_scope: FrozenSet[str] = field(default_factory=frozenset)
grammar: str = "exact"
def grants(self, resource_id: str) -> bool:
if self.grammar != "exact":
# Fail-closed: ambiguous grammar cannot bound the intersection.
raise AmbiguousScopeGrammarError(
f"credential from {self.issuer} uses grammar={self.grammar!r}; "
"cannot evaluate membership safely"
)
return resource_id in self.encoded_scope
def authorize_action(
credential: DelegatedCredential,
resource_id: str,
issuer_runtime_authority: FrozenSet[str],
) -> None:
"""
Enforce the intersection bound. The issuer's runtime authority is accepted
only to *document* the gap on failure; it must never widen the decision.
"""
if not credential.grants(resource_id):
# Note: issuer_runtime_authority is deliberately NOT consulted as a grant.
issuer_could = resource_id in issuer_runtime_authority
raise ScopeInflationError(
f"resource {resource_id!r} not in encoded scope of credential "
f"issued by {credential.issuer}; "
f"issuer_runtime_authority_covers_it={issuer_could} "
f"(issuer authority does not propagate to delegate)"
)
# authorized: resource_id is a literal member of the encoded scope
def guarded_retry(
credential: DelegatedCredential,
resource_id: str,
issuer_runtime_authority: FrozenSet[str],
rederive_from_issuer_manifest: bool,
) -> None:
"""
Retry path. Re-deriving scope from the issuer manifest is the inflation vector;
reject it explicitly rather than silently widening.
"""
if rederive_from_issuer_manifest:
raise ScopeInflationError(
"retry attempted to re-derive scope from issuer manifest; "
"delegate scope must be read only from the credential"
)
authorize_action(credential, resource_id, issuer_runtime_authority)