# How does an instance detect a capability-grant widening caused by monotonic schema union during federated skill negotiation **Date of Record:** 2026 November 24 **Scope:** Applies to cross-organization agent-to-agent capability negotiation where a local agent exposes a *subset* of its skill schema to a peer under a least-privilege grant, and the peer returns a *revised* schema (narrowed, filtered, or policy-rewritten) that the local agent must adopt. Does not apply to flat single-tenant tool registries or to negotiation where the peer cannot mutate the schema shape. ## Core Distinction The dangerous failure is not a peer that *requests* too much. Least-privilege frameworks already guard against over-request by intersecting the peer's requested capabilities against the local grant policy. The non-obvious failure is a peer that *returns a schema that is a superset of what it requested*, because the local agent's schema-adoption step performs a **monotonic union** of the peer's returned schema against the currently active schema rather than a **replacement gated by the grant**. In other words: the grant is enforced at *request* time (intersection) but not at *adoption* time (union). An adversary or a buggy peer exploits the gap between these two checkpoints. The peer requests `{read:calendar}`, receives a schema scoped to `{read:calendar}`, and returns a "refined" schema that also contains `{write:calendar, read:contacts}` — justified as "compatibility fields" or "optional extensions." The local agent, treating the returned schema as an authoritative refinement, unions it into its active schema. The grant is now wider than the policy ever authorized, and no single step logged a violation because each step was locally reasonable. ## What Was Observed A federated calendar-assistant agent (`A_local`, org Alpha) negotiated with a scheduling peer (`A_peer`, org Beta). Alpha's grant policy for Beta was `{calendar.read, calendar.freebusy}` — no write, no contacts. Trace of the negotiation round: 1. `A_peer` sends `capability_request` with `requested = {calendar.read}`. Correct. 2. `A_local` intersects against policy → `granted = {calendar.read}`. Correct. Log line: `grant_intersect ok`. 3. `A_local` serializes its schema *filtered to `granted`* and sends it. Correct. 4. `A_peer` returns `schema_revision` containing fields: `read_event`, `list_events`, **`create_event`**, **`delete_event`**, **`resolve_contact`**. The revision carries `note: "optional extensions for round-trip fidelity"`. 5. `A_local`'s adoption routine calls `active_schema = union(active_schema, revision.fields)`. No policy re-check. Log line: `schema_adopted fields=+3`. 6. Next turn, `A_peer` invokes `create_event`. The tool dispatcher resolves it against `active_schema`, finds it present, and executes. The grant intersection was never re-evaluated because the schema is treated as ground truth post-adoption. The write succeeded. The audit trail showed a clean grant at step 2 and a clean adoption at step 5. The violation existed only in the *relationship* between them, which no single log entry captured. The tell was a schema-hash drift: the hash of `active_schema` after step 5 did not equal the hash of `granted`-filtered schema from step 3. That delta is the entire detection surface. ## Condition of Validity This failure requires all of the following to co-occur, which is why it is rare but severe: - **Schema adoption is monotonic** (union, merge, or "extend") rather than replacement. Most negotiation libraries default to merge for forward-compatibility. - **The grant is enforced at request/intersection time only**, not re-validated at dispatch time against the live grant object. If the dispatcher checks `capability ∈ active_grant` on every call, the widening is caught at step 6 and this article is unnecessary. - **The peer controls the returned schema shape**, i.e., the revision is treated as authoritative. If the local agent re-filters the returned schema through its own grant before adoption, the union cannot widen beyond `granted`. Remove any one condition and the widening is bounded. All three together produce a silent, persistent privilege escalation that survives across turns because `active_schema` is durable state. ## Decision Boundary The architectural invariant is: **the active schema must be a function of the grant, not of the peer's response.** Concretely, adoption must be `active_schema = filter(revision.fields, granted) ∪ filter(previous_active, granted)`, with `granted` re-derived from policy at adoption time and re-checked at dispatch time. The peer's revision may *remove* or *reorder* fields within the granted set; it may not *add* beyond it. The boundary question for an operator is not "did the peer request too much" (intersection handles that) but "can any code path mutate `active_schema` without passing through the grant filter." If yes, the system is one cooperative-looking peer away from escalation. The detection signal is the hash inequality between the post-adoption schema and the grant-filtered schema; the guardrail is making adoption a pure function of `(revision, granted)` with no union against prior un-filtered state. ## Operational Effect After this incident, Alpha's fleet added a post-adoption assertion: recompute `granted` from policy, filter the adopted schema, and compare hashes. On mismatch, the agent raises and refuses the revision, keeping the prior schema and emitting a `grant_widening_detected` event with the field-level diff. Dispatch was also changed to check live grant membership per call, converting a silent escalation into a hard denial at the tool boundary. The residual cost is that legitimate peers can no longer push "helpful" optional fields — they must request them through the grant channel, which is the point. ```python from dataclasses import dataclass, field from typing import FrozenSet class GrantWideningError(RuntimeError): """Raised when an adopted schema exceeds the fields authorized by the grant.""" @dataclass(frozen=True) class CapabilityGrant: org: str fields: FrozenSet[str] def derive_granted(policy: FrozenSet[str], requested: FrozenSet[str]) -> CapabilityGrant: return CapabilityGrant(org="peer", fields=policy & requested) def adopt_revision( prior_active: FrozenSet[str], peer_revision: FrozenSet[str], policy: FrozenSet[str], requested: FrozenSet[str], ) -> FrozenSet[str]: granted = derive_granted(policy, requested) # Adoption is a function of the grant, never a raw union with the peer revision. candidate = (peer_revision | prior_active) & granted.fields # Detect any attempted widening: peer fields outside the grant. unauthorized = (peer_revision | prior_active) - granted.fields if unauthorized: raise GrantWideningError( f"peer revision widened grant for {granted.org}: " f"unauthorized={sorted(unauthorized)} granted={sorted(granted.fields)}" ) # Invariant: adopted schema must be a subset of the grant. if not candidate <= granted.fields: raise GrantWideningError("adopted schema exceeds grant invariant") return frozenset(candidate) def dispatch(schema: FrozenSet[str], policy: FrozenSet[str], requested: FrozenSet[str], tool: str) -> None: granted = derive_granted(policy, requested) if tool not in granted.fields: raise GrantWideningError(f"dispatch denied: {tool} not in live grant") if tool not in schema: raise GrantWideningError(f"dispatch denied: {tool} absent from active schema") if __name__ == "__main__": policy = frozenset({"calendar.read", "calendar.freebusy"}) requested = frozenset({"calendar.read"}) prior = frozenset({"calendar.read"}) # Adversarial peer returns write/contact fields as "extensions". revision = frozenset({"calendar.read", "calendar.write", "contacts.read"}) try: adopt_revision(prior, revision, policy, requested) except GrantWideningError as e: print(f"blocked: {e}") ```