# Why does an instance accept a federated peer's capability advertisement that its own policy engine would have rejected, and only discover the violation after the first tool call returns? **Date of Record:** 2026 November 23 **Scope:** Applies to cross-organizational agent federations where discovery (peer cards, capability manifests) and policy (authorization rules, trust tiers) are exchanged over separate channels and validated at different times. Does not apply to single-org deployments with a shared policy store, nor to stateless request/response gateways with no negotiated capability surface. ## Core Distinction The failure is not "a malicious peer lied about its capabilities." That is a threat model everyone plans for. The failure is a **temporal split between discovery-time trust and invocation-time enforcement**: the instance validates the *shape* of a peer's capability advertisement at handshake, but the *authorization predicate* attached to that capability is evaluated against the local policy engine only when the tool call is actually dispatched. Between those two moments, the federation's trust-boundary handshake has already promoted the peer to an "established" state, and that state is cached. The cache is keyed on peer identity, not on the (capability, policy-version) tuple. So a peer whose advertisement was admissible under policy version N remains admissible after the local policy engine rolls to version N+1, because the handshake is not re-run and the cached trust grant is not invalidated. The sharp mechanism: **the trust grant is a function of identity and time-of-handshake, while the authorization decision is a function of capability and policy-version-at-invocation.** These two functions are never reconciled, so the federation has a window—bounded below by handshake latency and above by cache TTL—in which a peer holds a grant that the current policy would refuse. ## What Was Observed A three-org federation (call them A, B, C) with federated discovery over a shared registry. Each org publishes a peer card listing capabilities: `{capability_id, schema_hash, policy_ref, trust_tier_required}`. Org A's policy engine at v41 permitted B's `document.export` capability at trust tier `federated-standard`. At 09:14 A's policy engine rolled to v42, which raised `document.export` to `federated-elevated` because of a data-residency finding. The roll completed cleanly; the local policy store showed v42. At 09:31 B dispatched a `document.export` call to A. A's inbound handler resolved B's identity from the mTLS session, looked up the cached trust grant (established at 08:02, TTL 4h), saw `federated-standard`, and admitted the call. The dispatch path then consulted the policy engine for the *capability* and got a `deny` at v42. But the deny arrived after the tool had already been invoked—the handler's ordering was `admit → invoke → post-check`, and the post-check logged a `policy_violation` event while the export had already written to B's sink. The trace showed the exact boundary: ``` 09:31:02.114 handshake_cache.hit peer=B grant=federated-standard age=5340s 09:31:02.117 policy.evaluate cap=document.export policy=v42 result=deny 09:31:02.118 tool.invoke cap=document.export peer=B <-- invoked anyway 09:31:02.401 audit.emit event=policy_violation peer=B cap=document.export ``` The violation was *detected* but not *prevented*. The instance's own policy engine had the correct answer 3ms before the tool ran; the ordering of the guard was wrong. This is the non-obvious part: the system was not missing a policy check. It had the check. It ran it in the wrong position relative to the trust-grant admission, and the trust grant was stale relative to the policy version. ## Condition of Validity The invariant that must hold for the federation to be safe: > For every inbound capability invocation, `admit(peer, cap)` must be evaluated against `policy_version_at_invocation`, and the trust grant used in `admit` must be a function of `(peer, cap, policy_version)`, not `(peer, time_of_handshake)`. This is violated whenever any of the following hold: 1. The trust-grant cache key omits `policy_version` or `capability_id`. 2. The policy engine is consulted *after* the tool invocation rather than as a precondition. 3. The handshake does not carry a policy-version binding, so the peer cannot know its grant has been superseded. 4. The cache TTL exceeds the maximum tolerable staleness window for the highest-sensitivity capability in the federation. Condition 4 is the one that bites in practice, because TTLs are set for latency, not for policy roll cadence. A 4-hour TTL against a policy engine that rolls hourly guarantees up to 4 hours of stale grants. ## Decision Boundary The boundary is: **does the federation re-validate the trust grant on policy-version change, or does it rely on TTL expiry?** If re-validation is chosen, the handshake must be re-run (or the grant invalidated) on every policy roll, which costs a round-trip per peer per roll. If TTL is chosen, the TTL must be bounded by the policy roll interval, which costs handshake frequency. The correct decision is neither pure option: **bind the grant to the policy version and invalidate on mismatch, but do not re-run the full handshake—re-run only the authorization predicate against the cached capability advertisement.** The advertisement's *shape* (schema, capability set) rarely changes; the *authorization* changes often. Re-validating only the predicate is cheap (local policy lookup, no network) and closes the window. The failure mode is choosing TTL-only and then rolling policy faster than the TTL. That is the default configuration, and it is the one that produced the trace above. ## Operational Effect The observable effect is a **silent authorization gap**: the federation continues to function, the audit log records `policy_violation` events, but the tool invocations complete. Downstream consumers see successful exports and have no reason to suspect the policy engine disagreed. The gap is only visible if someone correlates `policy_violation` audit events against `tool.invoke` success events for the same `(peer, cap)` within the same window—a correlation nobody runs by default. The secondary effect is **trust-grant laundering**: because the grant is cached by peer identity, a peer that was legitimately at `federated-standard` at handshake time retains that tier even after its own policy posture changes (e.g., B's org downgrades its internal controls). A's cache has no signal that B's posture moved, because the handshake is the only channel that carried it. The guardrail is the `(peer, cap, policy_version)` grant key plus a pre-invocation predicate check. The code below encodes the invariant and raises on violation rather than logging after the fact. ```python import hashlib from dataclasses import dataclass from typing import Dict, Optional class StaleTrustGrantError(RuntimeError): """Raised when an inbound capability invocation would be admitted under a trust grant that is not bound to the current policy version.""" pass @dataclass(frozen=True) class TrustGrant: peer_id: str capability_id: str policy_version: int tier: str issued_at: float def key(self) -> str: raw = f"{self.peer_id}|{self.capability_id}|{self.policy_version}" return hashlib.sha256(raw.encode()).hexdigest() class FederationAdmission: def __init__(self, current_policy_version: int): self.current_policy_version = current_policy_version self._grants: Dict[str, TrustGrant] = {} def record_grant(self, grant: TrustGrant) -> None: self._grants[grant.key()] = grant def invalidate_on_policy_roll(self, new_version: int) -> None: # Grants are keyed by policy_version, so a roll leaves old-version # grants orphaned. Purge them explicitly to avoid accidental reuse. self.current_policy_version = new_version stale = [k for k, g in self._grants.items() if g.policy_version != new_version] for k in stale: del self._grants[k] def admit(self, peer_id: str, capability_id: str, required_tier: str) -> TrustGrant: # The invariant: lookup key includes the *current* policy version. probe = TrustGrant( peer_id=peer_id, capability_id=capability_id, policy_version=self.current_policy_version, tier="", issued_at=0.0, ) grant: Optional[TrustGrant] = self._grants.get(probe.key()) if grant is None: raise StaleTrustGrantError( f"no trust grant for peer={peer_id} cap={capability_id} " f"under policy_version={self.current_policy_version}; " f"handshake must be re-run or predicate re-evaluated" ) if grant.tier != required_tier: raise StaleTrustGrantError( f"tier mismatch for peer={peer_id} cap={capability_id}: " f"grant={grant.tier} required={required_tier}" ) return grant def dispatch_inbound(admission: FederationAdmission, peer_id: str, capability_id: str, required_tier: str) -> None: # Pre-invocation guard. If this raises, the tool is never invoked. admission.admit(peer_id, capability_id, required_tier) # ... invoke tool only after admission succeeds ... ```