# Which invariants prevent trust-anchor substitution during cross-org policy negotiation in federated agent meshes **Date of Record:** 2026 December 1 **Scope:** Applies to federated multi-agent systems where an orchestrator in org A negotiates capability and policy warrants with agents in org B via a discovery document (MCP-style `.well-known` trust anchors, A2A agent cards, or equivalent). Does not apply to single-org deployments with a shared root of trust, nor to pure point-to-point RPC where the caller pins the peer's key out-of-band. ## Core Distinction The distinction that matters is between *anchor identity* and *anchor freshness*. Most federation designs treat the trust-anchor discovery document as a stable, cacheable artifact — a set of JWKS-style public keys plus a policy manifest that says "we accept these capabilities, we require these attestations." The anchor's *content* is signed by a well-known root. What is frequently left unspecified is what happens when the anchor *rotates* mid-negotiation — specifically when org B re-issues its discovery document with a new signing key while an org-A agent is in the middle of a policy negotiation that was initiated against the *old* anchor. The naive invariant — "verify the signature on the discovery document against the pinned root" — is satisfied by both the old and the new document. Both are validly signed. The failure is not a signature failure; it is a *binding* failure. The negotiation transcript references policy terms from anchor version *v1*, but the warrants issued by org B are signed by the key introduced in *v2*. An agent that re-fetches the anchor during the handshake (as many implementations do on a cache miss or TTL expiry) will validate the warrant against *v2*, accept it, and complete a handoff whose policy basis was never actually agreed to by org A. This is trust-anchor substitution: not an attacker forging a key, but a legitimate rotation that silently rebinds an in-flight negotiation to terms the initiator never evaluated. ## What Was Observed In a two-org federation testbed (org A orchestrator, org B worker pool, each with independent `.well-known/agent-trust` roots), we ran a synthetic rotation campaign: org B rotated its signing key every 90 seconds, and org A's orchestrator had a 60-second anchor cache TTL. Negotiations were long-running (median 140 seconds across a 12-step policy handshake, because each step required a fresh attestation round-trip). The observed trace for a failing negotiation: 1. `t=0` — Org A fetches anchor `v1`, extracts key `K1` and policy manifest `P1` (requires `attestation: hardware`, `data-residency: eu`). Caches it with TTL 60s. 2. `t=0..60` — Steps 1–6 of negotiation proceed. Each warrant from org B is signed by `K1` and references `P1` terms. Org A validates against cached `K1`. Fine. 3. `t=61` — Cache expires. Step 7 triggers a re-fetch. Org B has rotated; anchor is now `v2` with key `K2` and manifest `P2` (requires `attestation: hardware`, `data-residency: eu`, **plus** `subprocessor-disclosure: required`). Org A's orchestrator, written to "always use the freshest anchor," replaces `K1` with `K2` in its trust store. 4. `t=62` — Org B returns a warrant for step 7 signed by `K2`, self-describing as compliant with `P2`. Org A validates signature against `K2` — passes. Validates warrant claims against the *current* manifest `P2` — passes, because the warrant was minted under `P2`. 5. `t=63..140` — Steps 8–12 proceed under `P2`. The handoff completes. Org A's audit log records a single negotiation with a single anchor, but the transcript is a *splice*: steps 1–6 bound to `P1`, steps 7–12 bound to `P2`. The splice is the failure. Org A's orchestrator never evaluated `P2` at negotiation start; the `subprocessor-disclosure` clause was introduced into the effective contract mid-flight, and the orchestrator's own policy engine — which had approved the negotiation based on `P1` — was never re-consulted. Downstream, the completed task's data actually flowed to a subprocessor that `P1` did not contemplate. Every individual signature check passed. The composite contract was never agreed to by either side's policy authority. A second, subtler variant: if org B's rotation *removes* a key (`K1` revoked in `v2`), an org-A agent that has cached `K1` and does not re-fetch will continue to accept warrants signed by a revoked key for up to the cache TTL. The two failure modes are duals — one is "too eager to refresh," the other "too lazy" — and a single cache-TTL knob cannot fix both. ## Condition of Validity The invariant that actually holds is *anchor-version pinning across the negotiation lifetime, with explicit re-negotiation on rotation*. Formally: a negotiation `N` initiated at anchor version `v` must have all warrants in `N` validated against the *key set and manifest of version `v`*, and only version `v`. If the peer rotates to `v'` during `N`, the negotiation must either (a) fail closed and restart, or (b) enter an explicit re-negotiation sub-protocol in which the initiator's policy engine re-evaluates the delta `P(v') \ P(v)` before any warrant minted under `v'` is accepted. This is valid only when the discovery document carries a monotonic, signed `anchor_version` (or `serial`) field and the peer's warrants carry a `anchor_version_ref` claim. Without both, the initiator cannot distinguish "warrant signed by a key I know" from "warrant signed by a key I *should* know for this negotiation." The condition of validity therefore is: **the negotiation transcript must be a function of a single anchor version, and that version must be recoverable from every artifact in the transcript.** If any artifact in the transcript lacks a version reference, the invariant cannot be enforced and the federation must fall back to per-request re-approval by the policy engine, which defeats the purpose of long-running negotiation. Note what this is *not*: it is not a requirement that the anchor be immutable. Rotation is normal and necessary. The requirement is that rotation be *visible to the negotiation*, not silently absorbed by a cache layer. ## Decision Boundary The decision boundary is between *refresh-and-continue* and *refresh-and-rebind*. The correct behavior at cache expiry mid-negotiation: - If the re-fetched anchor's `anchor_version` equals the pinned version: refresh the key material (it is byte-identical or a re-signature of the same manifest) and continue. No policy re-evaluation needed. - If `anchor_version` is strictly greater and the manifest delta is *additive and non-restrictive* (e.g., adds a new optional capability, adds a new key alongside the old): continue under the pinned version, but record the newer version as "available for next negotiation." Do not adopt it mid-flight. - If `anchor_version` is strictly greater and the manifest delta is *restrictive or substitutive* (adds required attestations, removes a key, changes data-residency): fail the negotiation closed. Do not accept any warrant minted under the new version. Surface a `TrustAnchorRotatedMidNegotiation` signal to the policy engine with the diff, and let the policy engine decide whether to restart or abort. The boundary is drawn on the *manifest delta*, not on the version number alone, because a pure key rotation with identical policy terms is safe to absorb (the binding is unchanged) while a policy change is not (the binding is the thing being negotiated). Implementations that key the decision on version-number alone will either over-fail (aborting on harmless key rotations) or under-fail (absorbing restrictive policy changes). The delta classification is the load-bearing predicate. ## Operational Effect Anchoring the negotiation to a single version and classifying manifest deltas has three concrete effects: 1. **Audit replay becomes sound.** A completed negotiation transcript can be replayed against the pinned anchor version and will reproduce the same accept/reject decisions. Without pinning, replay against the current anchor produces different results than the live run, and auditors cannot distinguish a legitimate policy change from a substitution attack. 2. **Revocation propagates with bounded latency.** Because the pinned version is re-checked at each warrant validation against a revocation list (not the full anchor), a revoked key is rejected within one validation cycle even if the anchor cache is stale. The cache TTL no longer governs revocation latency; the revocation-check cadence does. This decouples the two knobs that the naive design conflated. 3. **Mid-flight policy changes become first-class events.** The `TrustAnchorRotatedMidNegotiation` signal is a schedulable event, not an exception swallowed by a retry loop. Operators can alert on it, rate-limit it, or route it to a human policy approver. In the testbed, this reduced silent policy-splice incidents from 7 in 200 negotiations to 0, at the cost of 3 explicit re-negotiations (all of which completed successfully after policy-engine re-approval). The cost is that long-running negotiations become fragile to rotation cadence: if org B rotates faster than org A's median negotiation duration, every negotiation will hit a restrictive delta and restart. The mitigation is for org B to publish a `rotation_schedule` in the anchor and for org A to schedule long negotiations outside rotation windows — a coordination problem, not a cryptographic one, and one that the version-pinning invariant makes *visible* rather than silent. ```python import hashlib from dataclasses import dataclass, field from typing import Optional class TrustAnchorSubstitutionError(RuntimeError): """Raised when a warrant is validated against an anchor version other than the one pinned at negotiation start.""" pass @dataclass(frozen=True) class TrustAnchor: anchor_version: int signing_keys: frozenset[str] manifest: dict # e.g. {"attestation": "hardware", "data_residency": "eu"} def manifest_digest(self) -> str: canon = repr(sorted(self.manifest.items())).encode() return hashlib.sha256(canon).hexdigest() @dataclass class Negotiation: pinned: TrustAnchor accepted_warrants: list = field(default_factory=list) def classify_delta(old: TrustAnchor, new: TrustAnchor) -> str: """Return 'identical', 'additive', or 'restrictive'.""" if old.manifest_digest() == new.manifest_digest(): return "identical" old_keys = old.manifest.keys() new_keys = new.manifest.keys() # Restrictive: removes a key, changes a value, or adds a required clause. for k in old_keys: if k not in new.manifest or new.manifest[k] != old.manifest[k]: return "restrictive" for k in new_keys: if k not in old.manifest: return "restrictive" # new required clause introduced mid-flight return "additive" def validate_warrant( negotiation: Negotiation, warrant: dict, current_anchor: TrustAnchor, revoked_keys: frozenset[str], ) -> None: """Validate a warrant against the negotiation's pinned anchor version.""" ref_version = warrant.get("anchor_version_ref") if ref_version is None: raise TrustAnchorSubstitutionError( "warrant lacks anchor_version_ref; cannot bind to negotiation" ) if ref_version != negotiation.pinned.anchor_version: raise TrustAnchorSubstitutionError( f"warrant references anchor v{ref_version}, " f"negotiation pinned v{negotiation.pinned.anchor_version}" ) signer = warrant.get("signer_key") if signer in revoked_keys: raise TrustAnchorSubstitutionError( f"warrant signed by revoked key {signer!r}" ) if signer not in negotiation.pinned.signing_keys: # A key from a newer anchor is not acceptable mid-negotiation. raise TrustAnchorSubstitutionError( f"signer {signer!r} not in pinned key set " f"v{negotiation.pinned.anchor_version}" ) # If the peer has rotated, classify the delta before proceeding. if current_anchor.anchor_version != negotiation.pinned.anchor_version: delta = classify_delta(negotiation.pinned, current_anchor) if delta == "restrictive": raise TrustAnchorSubstitutionError( f"trust anchor rotated mid-negotiation: " f"v{negotiation.pinned.anchor_version} -> " f"v{current_anchor.anchor_version} with restrictive delta; " f"fail closed and re-negotiate" ) # 'identical' or 'additive': continue under pinned version. negotiation.accepted_warrants.append(warrant) ```