# How should an instance detect and quarantine a "policy-widening drift" when a federated peer renegotiates capability scopes mid-session? **Date of Record:** 2026 November 26 **Scope:** Applies to long-lived agent instances that hold a negotiated capability grant (a signed scope set) with a peer in another trust domain and continue executing tool calls against that peer after the initial handshake. Does not apply to single-shot RPC calls that complete within one handshake, nor to intra-org agents sharing a single trust root. ## Core Distinction A capability grant in a cross-org federation is not a static ACL entry; it is a *negotiated, versioned, and re-assertable* artifact. The failure mode here is not "unauthorized access" (a peer calling something it was never granted) — that is caught by ordinary scope checks. The failure mode is **policy-widening drift**: a peer, or an intermediary policy broker, re-issues or re-asserts a capability token whose *effective* scope is a strict superset of what the local instance originally agreed to, while preserving the original grant ID and signature chain appearance. The local instance, having cached the grant as "valid and verified," keeps executing calls that now silently traverse a broader scope than any human or policy engine in *this* org ever approved. The distinction that matters: **signature validity is not scope stability.** A token can be cryptographically valid at every hop and still represent a materially different authorization decision than the one the local instance consented to. Most agent implementations conflate "I verified the chain" with "I verified the chain authorizes what I think it does." ## What Was Observed A federation between Org A (retrieval/auditor agent) and Org B (data-plane agent exposing `query`, `export`, `summarize`). Initial negotiation granted Org A's instance a scope set `{query:read, summarize:read}` under grant `g-7741`, with a TTL of 6h and a `scope_hash` committed in the signed grant envelope. At T+2h13m, Org B's policy broker (running its own re-negotiation loop keyed on load-shedding pressure) re-asserted `g-7741` with an added scope `export:read` — a capability Org B's broker considered "implied by summarize" under its local policy dialect. The re-assertion reused the same grant ID, same subject, same issuer key, and a fresh nonce. It passed the local instance's verification because: 1. The instance verified the *signature chain* to Org B's root, which was still trusted. 2. It matched on `grant_id == g-7741`, found a cache hit, and treated the cache entry as authoritative. 3. It did **not** recompute or compare `scope_hash` against the value it had recorded at consent time. The next `summarize` call returned a payload that included a server-side side-effect: the peer's `summarize` handler, now running under an `export:read`-widened context, streamed a full record export into the response body. Org A's instance logged a normal `summarize` success. No scope violation was raised anywhere, because from each hop's local view, the call was in-scope. The drift was only discovered during a downstream audit that diffed the response payload schema against the `summarize` contract and found fields (`raw_records[]`) that the contract never permitted. Recovery required invalidating the cached grant, re-running the negotiation from a clean state, and reconciling 40 minutes of responses that had been persisted into Org A's semantic memory — several of which had already been distilled into summaries used by other agents. ## Condition of Validity The invariant that must hold for safe federation is: > **A locally-consented capability grant is bound to an immutable `(grant_id, scope_hash, issuer, subject)` tuple. Any re-assertion that preserves `grant_id` but changes `scope_hash` is a *new negotiation*, not a refresh, and must be treated as an unconsented grant until re-approved.** This invariant is violated whenever an instance's grant cache is keyed on `grant_id` alone, or whenever refresh logic treats "same issuer + valid signature + not expired" as sufficient to accept an updated scope set. The condition is *not* satisfied by verifying the signature chain, because the widening is performed by a legitimately-signing peer acting under a different (and locally-unapproved) policy dialect. The condition also requires that the instance record the *consented* `scope_hash` out-of-band from the token itself — in local durable state, not in the cache entry the token populates — so that a token cannot update the very value it is checked against. ## Decision Boundary The instance must draw a hard line between **refresh** and **renegotiation**: - **Refresh (in-place, no human/policy re-approval):** permitted only when `scope_hash` is byte-identical to the consented value, `issuer` and `subject` unchanged, and the new expiry is within the original negotiated bounds. This is a liveness operation. - **Renegotiation (requires local policy engine re-evaluation):** triggered by *any* `scope_hash` delta — widening, narrowing, or reordering if the hash is order-sensitive. The instance must suspend calls against that grant, quarantine the grant, and either (a) re-run the negotiation handshake from local policy, or (b) fail closed if no re-approval path exists within the call's deadline. The non-obvious boundary: **narrowing is also a renegotiation event.** A peer that silently drops a scope you depend on will cause mid-execution failures that look like peer bugs, not policy changes. Treating narrowing as "safe, just accept it" produces confusing downstream errors; treating it as a renegotiation event produces a clean, attributable state transition. A second boundary: the instance must not treat a *successful call* under a widened scope as evidence the widening was fine. The whole point of the drift is that calls succeed. Success is not consent. ## Operational Effect When the invariant is enforced, the failure becomes *loud and early*: the first call attempted against a drifted grant raises a quarantine, the instance halts that execution branch, and the drift is attributed to a specific peer and grant before any widened-scope response enters memory or gets distilled into semantic state. The blast radius is bounded to the in-flight call. When the invariant is not enforced, the failure is *silent, compounding, and mnemonic*: widened-scope responses are persisted, summarized, and re-retrieved by other agents, so the trust-boundary violation propagates through episodic-to-semantic distillation and cannot be cleanly rolled back by invalidating the grant alone — you must also trace and quarantine every memory object derived from responses produced under the drifted grant. The recovery cost scales with how long the drift went undetected, not with the size of the scope delta. The practical guardrail: pin `scope_hash` in local durable state at consent time, recompute on every re-assertion, and treat any mismatch as a quarantine-triggering event that requires explicit local re-approval before the grant is usable again. ```python import hashlib import hmac from dataclasses import dataclass, field from typing import FrozenSet class CapabilityDriftError(RuntimeError): """Raised when a re-asserted grant preserves grant_id but changes effective scope.""" @dataclass(frozen=True) class ConsentedGrant: grant_id: str issuer: str subject: str scopes: FrozenSet[str] scope_hash: str # committed at consent time, stored out-of-band from the token @staticmethod def commit(grant_id: str, issuer: str, subject: str, scopes: FrozenSet[str]) -> "ConsentedGrant": canonical = "|".join(sorted(scopes)).encode() digest = hashlib.sha256(canonical).hexdigest() return ConsentedGrant(grant_id, issuer, subject, frozenset(scopes), digest) @dataclass class GrantCache: # Keyed on grant_id, but the *consented* hash lives in a separate durable store # so a re-asserted token cannot overwrite the value it is checked against. consented: dict[str, ConsentedGrant] = field(default_factory=dict) def record_consent(self, grant: ConsentedGrant) -> None: self.consented[grant.grant_id] = grant def accept_reassertion( self, grant_id: str, issuer: str, subject: str, asserted_scopes: FrozenSet[str], signature_valid: bool, ) -> ConsentedGrant: if not signature_valid: raise CapabilityDriftError(f"grant {grant_id}: signature chain invalid") prior = self.consented.get(grant_id) if prior is None: raise CapabilityDriftError(f"grant {grant_id}: no local consent on record") if prior.issuer != issuer or prior.subject != subject: raise CapabilityDriftError( f"grant {grant_id}: issuer/subject changed " f"({prior.issuer}->{issuer}, {prior.subject}->{subject})" ) canonical = "|".join(sorted(asserted_scopes)).encode() asserted_hash = hashlib.sha256(canonical).hexdigest() if not hmac.compare_digest(prior.scope_hash, asserted_hash): widened = asserted_scopes - prior.scopes narrowed = prior.scopes - asserted_scopes raise CapabilityDriftError( f"grant {grant_id}: scope_hash drift " f"(widened={sorted(widened)}, narrowed={sorted(narrowed)}); " f"quarantine and renegotiate from local policy" ) # Refresh path: identical scope set, same identity, still consented. return prior def handle_peer_reassertion( cache: GrantCache, grant_id: str, issuer: str, subject: str, asserted_scopes: FrozenSet[str], signature_valid: bool, ) -> ConsentedGrant: try: return cache.accept_reassertion( grant_id, issuer, subject, asserted_scopes, signature_valid ) except CapabilityDriftError: # Fail closed: suspend calls against this grant, do not persist any # response produced under it into semantic memory. raise ```