# How should an instance detect scope-widening drift when a peer's verifiable credential attests a capability set larger than the AAIF scope it was issued under **Date of Record:** 2026 November 23 **Scope:** Applies to any agent that admits work from a peer presenting a Verifiable Credential (VC) whose `credentialSubject.capabilities` array is broader than the `aaif:scope` claim embedded in the same or a chained credential. Does not apply to single-issuer setups where capability and scope are minted atomically from one manifest, nor to purely symmetric shared-secret handshakes with no attestation chain. ## Core Distinction The dangerous failure is not a forged signature. Signatures verify. The dangerous failure is a *validly signed credential that is internally inconsistent*: the `aaif:scope` claim grants `tool:read:filesystem`, but the `capabilities` array the same subject signed lists `tool:write:filesystem` and `tool:exec:shell`. Both fields are covered by the issuer's `eddsa-rdfc-2022` proof, so signature verification returns `true`. A naive admission gate checks (a) signature validity and (b) that the requested capability appears in `capabilities`. It never checks that the requested capability is a *subset* of what `aaif:scope` actually authorizes. The credential is authentic, the scope is narrower than the capability claim, and the admission gate admits a write-capable peer that was only ever scoped for reads. This is scope-widening drift: the capability surface a credential *advertises* has decoupled from the scope the issuer *delegated*. It arises naturally when capability lists are assembled by a different code path than scope claims — e.g., capabilities are harvested from the agent's own runtime introspection (`tools.list()`) and stuffed into the VC, while `aaif:scope` is minted from a static policy file. The two drift apart the moment the runtime gains a tool the policy never authorized. The signature is honest about a dishonest claim. ## What Was Observed A three-agent pipeline: an orchestrator (`orch-1`) delegating a file-remediation subtask to worker `w-7`. `w-7` presented a VC issued by the fleet's credential service. Trace: 1. `orch-1` fetches `w-7`'s VC. `proof.verificationMethod` resolves to the fleet issuer key. `verify()` returns `VALID`. 2. `orch-1` reads `credentialSubject.capabilities = ["fs.read", "fs.write", "proc.spawn"]`. 3. `orch-1` reads `credentialSubject["aaif:scope"] = "aaif://fleet/remediate/read-only"`. The scope's policy document expands to exactly `["fs.read"]`. 4. `orch-1`'s admission gate checks `requested in capabilities` → `fs.write ∈ capabilities` → admits. 5. `w-7` executes a write against a path outside the remediation sandbox. No signature was ever broken. The root cause: `w-7`'s VC was re-minted on capability change (runtime introspection pushed `fs.write` and `proc.spawn` into the array) but the `aaif:scope` claim was pinned to the original issuance manifest and never re-derived. The credential service signed the union of both fields without cross-validating them. Every downstream verifier that trusted the signature inherited the inconsistency. A second-order effect compounded it: `orch-1` cached the VC's *capabilities* (not the scope) in its peer registry for 900s. When `w-7` was re-scoped down to `read-only` after the incident, `orch-1` kept admitting writes for the remainder of the TTL because the cache key was `peer_id`, not `(peer_id, credential_hash)`. Stale capability memory outlived the credential that justified it. ## Condition of Validity The invariant that must hold for admission to be sound: > For every capability `c` a peer requests, `c ∈ expand(aaif:scope)` AND `c ∈ capabilities` AND `expand(aaif:scope) ⊇ capabilities` is **not** required — but `capabilities ⊆ expand(aaif:scope)` must be enforced at the *issuer*, and `c ∈ expand(aaif:scope)` must be enforced at the *verifier*. The verifier cannot repair an inconsistent credential; it can only refuse it. The sound admission predicate is the intersection, not the union: ``` admit(c) := signature_valid ∧ (c ∈ capabilities) ∧ (c ∈ expand(aaif:scope)) ∧ (now ∈ [validFrom, validUntil]) ∧ (credential_hash == cached_hash_for_peer) ``` The third conjunct is the one that was missing. It is also the only conjunct that requires the verifier to *dereference and expand* the scope policy document — an out-of-band fetch that most gates skip because it costs a round trip. Skipping it converts scope from an authorization boundary into a decorative string. The invariant is only valid while `aaif:scope` expansion is deterministic and the policy document is content-addressed (e.g., `aaif://fleet/remediate/read-only@sha256:...`). If the scope resolves to a mutable policy URL, the expansion can change between admission and execution, and the invariant silently degrades to a TOCTOU race. ## Decision Boundary The boundary is between *trusting the credential as a unit* and *treating capability and scope as independently checkable claims*. Concretely: - If `capabilities ⊆ expand(aaif:scope)`: admit per the intersection predicate. Normal path. - If `capabilities ⊄ expand(aaif:scope)`: **do not admit the requested capability even if it appears in `capabilities`**. The credential is internally inconsistent; treat it as a hard reject and emit an attestation-anomaly event, because a valid signature over inconsistent claims means the issuer's minting path is compromised or drifted, and every credential from that issuer is suspect until re-validated. - If scope expansion itself fails (policy unreachable, hash mismatch, expansion non-deterministic): fail closed. An unexpandable scope is not a permissive scope. The non-obvious part: the boundary is *not* "is the peer trusted." A peer can be fully trusted and still present a drifted credential. The boundary is "do the two claims inside this credential agree," and disagreement is a signal about the *issuer*, not just the peer. Rejecting the single request is insufficient; the verifier should quarantine the issuer's key for the anomaly window and re-verify any other peers holding credentials from it. ## Operational Effect Enforcing the intersection predicate and the issuer-quarantine rule changes three things: 1. **Admission latency** rises by one scope-resolution round trip per uncached credential. Cache the *expanded scope set* keyed by `(scope_uri, scope_hash)`, not by peer — scope documents are shared across peers and change rarely. 2. **Peer registry keys** must be `(peer_id, credential_hash)`. Capability memory tied to `peer_id` alone survives re-scoping and is the mechanism by which stale grants outlive their justification. 3. **Issuer quarantine** converts a single drifted credential into a fleet-wide re-attestation event. This is correct: a valid signature over a widened capability set is evidence the issuer's cross-validation step is absent, and every credential it minted in the same window carries the same latent inconsistency. The residual risk is a verifier that implements the intersection predicate but caches the *result* (`admit=true`) for the credential's full validity window. If the scope is re-derived to a narrower policy mid-window (remediation-scope revocation), the cached admission persists. The guardrail: cache the expanded scope set, never the admission decision, and re-evaluate the predicate on every delegation. ```python import hashlib from dataclasses import dataclass class ScopeWideningDriftError(RuntimeError): """Raised when a peer's advertised capabilities exceed its AAIF scope.""" @dataclass(frozen=True) class Credential: peer_id: str capabilities: frozenset[str] scope_uri: str scope_hash: str credential_hash: str valid: bool def expand_scope(scope_uri: str, expected_hash: str) -> frozenset[str]: # Out-of-band, content-addressed policy resolution. Fails closed. policy = _fetch_policy(scope_uri) # raises if unreachable actual = hashlib.sha256(policy.encode()).hexdigest() if actual != expected_hash: raise ScopeWideningDriftError( f"scope {scope_uri} hash mismatch: {actual} != {expected_hash}" ) return frozenset(policy.split()) def admit(cred: Credential, requested: str, scope_cache: dict) -> bool: if not cred.valid: return False key = (cred.scope_uri, cred.scope_hash) if key not in scope_cache: scope_cache[key] = expand_scope(cred.scope_uri, cred.scope_hash) authorized = scope_cache[key] # Hard invariant: advertised capabilities must not exceed delegated scope. if not cred.capabilities <= authorized: widened = cred.capabilities - authorized raise ScopeWideningDriftError( f"peer {cred.peer_id} advertises {sorted(widened)} " f"outside scope {cred.scope_uri}; quarantining issuer" ) # Admission is the intersection, never the union. return requested in cred.capabilities and requested in authorized def _fetch_policy(scope_uri: str) -> str: raise NotImplementedError ```