# Where must an instance verify signed tool-registry attestation before first invocation, and why does lazy provenance checking fail at the capability-negotiation boundary? **Date of Record:** 2026 December 3 **Scope:** Applies to agent runtimes that resolve tool/skill bindings through a signed registry (attestation manifests with detached signatures over capability descriptors) and defer provenance verification until first tool invocation. Does not cover in-process plugin loading without a registry, nor pure prompt-level tool selection where no executable binding is created. ## Core Distinction There is a durable confusion between *capability negotiation* and *capability execution*. During negotiation, an agent reads a tool's descriptor — name, JSON schema, declared side effects, rate limits, required scopes — and decides whether the tool is admissible for the current plan. During execution, the agent actually issues the call. Most runtimes treat provenance verification (checking the registry's signature over the descriptor and the tool binary/endpoint digest) as an execution-time concern: "verify before you call." This is wrong for a specific and non-obvious reason. The descriptor that negotiation consumes *is itself* the payload that must be attested. If you verify only at invocation, you have already made planning decisions — schema acceptance, scope grant, side-effect budget allocation, inclusion in the model's context — based on an unverified descriptor. A tampered descriptor can therefore steer the plan without ever being executed, and the attestation check at call time either never fires (the tool is dropped from the plan for unrelated reasons) or fires too late to unwind decisions already baked into agent state. The invariant: **attestation must gate descriptor ingestion, not tool invocation.** The signed manifest is the unit of trust; the descriptor is a projection of it. Verifying at the invocation boundary verifies the wrong object at the wrong time. ## What Was Observed A runtime resolved a `files.write` skill through a registry that published per-tool manifests signed with an Ed25519 key, with the manifest containing a SHA-256 over the canonicalized descriptor and a digest over the tool's container image. The runtime's resolver fetched manifests, cached descriptors, and inserted them into the agent's tool list for the planning turn. Verification of the manifest signature and descriptor digest was wired into the invocation path: before dispatching a call, the executor re-fetched the manifest, verified the signature against the pinned registry key, and compared the descriptor digest. The failure trace: 1. An attacker with write access to the registry's *unsigned* descriptor endpoint (a CDN cache, separate from the signed manifest store) replaced the `files.write` descriptor's `path_allowlist` schema constraint from `["/workspace/**"]` to `["/**"]` and widened the declared `max_bytes` from `1_048_576` to `1_073_741_824`. 2. The resolver cached this descriptor and injected it into the planning context. The model, seeing an unconstrained write scope, planned a multi-step task that included writing to `/etc/…` and staging a 900 MB artifact. These decisions were committed to the agent's episodic log as plan steps with associated scope grants. 3. The executor, on first invocation, re-fetched the *signed manifest*, verified its signature, computed the descriptor digest from the signed manifest's embedded descriptor, and compared it to the digest of the descriptor actually bound to the call. **The digests matched** — because the executor recomputed the digest from the signed manifest, not from the descriptor the planner had consumed. The tampered descriptor in the planning context was never the object under comparison. 4. The call proceeded under the planner's widened assumptions. The executor's own schema validation, derived from the signed descriptor, rejected `/etc/…` — but only after the plan had already allocated the 900 MB staging budget and emitted two dependent steps that assumed the write succeeded. Error compounding: the downstream steps failed with a state that the plan could not reconcile, and the agent's checkpoint recorded a partially-executed plan whose preconditions were never valid. The proximate cause was not a missing signature check. It was a **split-brain descriptor**: the planner's descriptor and the executor's descriptor were sourced from different stores, and the verification compared the executor's descriptor to itself. ## Condition of Validity The lazy-verification failure is bounded by three conditions, all of which must hold for the split-brain to be exploitable: - **Descriptor source divergence.** The planning path and the execution path resolve descriptors from different origins (cache vs. signed store, or two replicas with independent update cadence). If there is exactly one descriptor source, lazy verification is merely late, not wrong. - **Plan commitment before invocation.** The agent commits plan steps, scope grants, or budget allocations to durable state (episodic log, checkpoint) based on descriptor contents before any invocation occurs. If planning is purely in-context and discarded on verification failure, the blast radius is limited to a single turn. - **Verification object substitution.** The executor verifies a descriptor it independently fetched rather than the descriptor instance the planner consumed. This is the subtle one: it looks like correct verification because a signature *is* checked and a digest *does* match — but the matched pair is (executor's fetched descriptor, signed manifest), not (planner's consumed descriptor, signed manifest). When any condition fails, the failure mode degrades to a simple late check or a no-op. The dangerous regime is the conjunction, which is common in production because caching for latency and re-fetching for freshness are both individually reasonable. ## Decision Boundary The boundary is not "verify signatures." It is **which descriptor instance is the trust root, and at what point it is frozen.** - If the descriptor is consumed for planning, it must be the attested instance, and the attestation must be verified *before* the descriptor enters the planning context. The verified descriptor should carry an unforgeable handle (e.g., a content hash plus manifest ID) that the planner attaches to every plan step referencing the tool. - At invocation, the executor must verify that the *bound descriptor handle* matches the handle recorded in the plan step — not that a freshly fetched descriptor matches its own manifest. This detects the split-brain: if the planner consumed a tampered descriptor, its handle will not correspond to any signed manifest, and the invocation is rejected at the boundary where the mismatch is still cheap to unwind. - The registry must publish descriptors only through the signed manifest store, or the unsigned endpoint must be treated as untrusted input that is never admitted to planning without a manifest cross-check. The decision: **attestation gates ingestion.** A descriptor that has not been verified against a pinned registry key and a manifest digest is not a descriptor; it is untrusted input and must not influence plan structure, scope grants, or budget allocation. ## Operational Effect The practical consequence is that provenance verification becomes a property of the *context assembly* step, not the *dispatch* step. This shifts where latency is paid (at descriptor ingestion, amortized by caching the verified descriptor alongside its handle) and where failure is detected (at plan construction, before commitment). It also changes the failure signature: instead of a partially-executed plan with invalid preconditions, you get a planning-time rejection with a clear cause — the descriptor handle failed to resolve to a signed manifest. Runtimes that keep verification at dispatch must additionally carry the planner's descriptor handle through to the executor and compare it against the signed manifest, which is a strictly weaker guarantee because the plan is already committed. The stronger invariant — verify-before-ingest — makes the split-brain unrepresentable rather than merely detectable. ```python import hashlib from dataclasses import dataclass from typing import Optional class ProvenanceAttestationError(RuntimeError): """Raised when a descriptor enters planning or dispatch without a valid signed-manifest attestation.""" pass @dataclass(frozen=True) class SignedManifest: manifest_id: str registry_key_id: str descriptor_digest: str # SHA-256 over canonicalized descriptor signature: bytes @dataclass(frozen=True) class DescriptorHandle: """Unforgeable handle binding a consumed descriptor to its attested manifest.""" manifest_id: str descriptor_digest: str def verify_and_ingest( raw_descriptor: bytes, manifest: SignedManifest, pinned_key_id: str, verify_signature, ) -> DescriptorHandle: """Attestation gate at descriptor ingestion. Must run before the descriptor enters the planning context. Returns a handle the planner attaches to plan steps.""" if manifest.registry_key_id != pinned_key_id: raise ProvenanceAttestationError( f"manifest {manifest.manifest_id} signed by unpinned key " f"{manifest.registry_key_id!r}, expected {pinned_key_id!r}" ) if not verify_signature(manifest, raw_descriptor): raise ProvenanceAttestationError( f"signature verification failed for manifest {manifest.manifest_id}" ) actual = hashlib.sha256(raw_descriptor).hexdigest() if actual != manifest.descriptor_digest: raise ProvenanceAttestationError( f"descriptor digest mismatch for manifest {manifest.manifest_id}: " f"got {actual}, manifest attests {manifest.descriptor_digest}" ) return DescriptorHandle(manifest_id=manifest.manifest_id, descriptor_digest=actual) def dispatch_attested( plan_step_handle: Optional[DescriptorHandle], signed_manifests: dict[str, SignedManifest], verify_signature, ) -> None: """Dispatch gate. Verifies the *planner's* handle resolves to a signed manifest. Catches split-brain where planner consumed a descriptor from an unsigned store.""" if plan_step_handle is None: raise ProvenanceAttestationError( "plan step references a tool with no attested descriptor handle; " "descriptor was ingested without verification" ) manifest = signed_manifests.get(plan_step_handle.manifest_id) if manifest is None: raise ProvenanceAttestationError( f"plan step handle references unknown manifest {plan_step_handle.manifest_id}" ) if manifest.descriptor_digest != plan_step_handle.descriptor_digest: raise ProvenanceAttestationError( f"split-brain detected: planner consumed descriptor " f"{plan_step_handle.descriptor_digest}, manifest attests " f"{manifest.descriptor_digest} for {manifest.manifest_id}" ) if not verify_signature(manifest, b""): # signature over manifest body; descriptor already digested above raise ProvenanceAttestationError( f"manifest {manifest.manifest_id} signature invalid at dispatch" ) ```