# In what scenarios must an instance re-verify a signed tool registry attestation mid-execution rather than trusting the TUF root fetched at cold start **Date of Record:** 2026 November 23 **Scope:** Applies to agents that load tool/skill manifests from a signed registry (TUF-style root + snapshot + targets metadata, or Sigstore/Cosign attestations bound to a manifest digest) and cache that verified state for the life of a session. Does not apply to stateless single-shot tool calls where the manifest is re-fetched and re-verified per invocation, nor to air-gapped registries with a fixed, immutable root. ## Core Distinction The distinction that matters is between **attestation freshness** and **attestation validity**. A cold-start verification proves that at time *t₀* the manifest *M* was signed by a key chaining to a trusted root *R*. It does *not* prove that *M* is still the manifest the registry intends to serve at *t₁*, nor that the signing key has not been rotated out or revoked between *t₀* and *t₁*. Agent runtimes routinely conflate the two: they perform a full TUF/Sigstore verification once, cache the resolved `(manifest_digest, key_id, root_version)` triple in session state, and then execute hundreds of tool calls against that cached decision. The failure mode is that the cached triple is a **point-in-time assertion masquerading as a durable capability grant**. When the registry rotates a key, revokes a compromised signing identity, or rolls back a malicious manifest, the agent's cached grant silently outlives the registry's intent. This is not a cryptographic break — every signature still verifies against the *old* root — it is a **temporal scope violation** in the trust chain. ## What Was Observed A coding agent session ran for 6h 40m across 212 tool invocations against a registry serving `shell.exec`, `file.write`, and `net.fetch` manifests. At cold start, the runtime fetched TUF metadata at `root_version=3`, verified `snapshot.json`, resolved `targets.json`, and cached the resulting digests for all three tools. At *t₀ + 2h 15m*, the registry operator revoked the signing key for `net.fetch` (key `K_fetch_2`) after detecting a compromised CI runner, published `root_version=4` with the key removed from the trusted set, and re-signed `net.fetch` under `K_fetch_3` with a narrowed egress allowlist. The agent's runtime never re-fetched root metadata. Every subsequent `net.fetch` invocation re-verified the *cached* manifest against the *cached* root v3 and passed. The agent continued issuing `net.fetch` calls under the revoked key's manifest for 4h 25m, including 38 calls to an egress host that v4 had removed from the allowlist. The signatures were all valid. The trust decision was all stale. The trace showed the exact state transition: ``` t0 : root_v3 fetched, verified, cached. net.fetch -> K_fetch_2, egress=[a,b,c] t0+2h15m : registry publishes root_v4 (K_fetch_2 revoked), net.fetch -> K_fetch_3, egress=[a,b] t0+2h15m : agent runtime: no re-fetch (cache TTL = session lifetime) t0+2h16m : agent invokes net.fetch(host=c) -> cache hit, verify vs root_v3 -> PASS t0+6h40m : session ends. 38 calls to host c under revoked manifest. ``` The load-bearing detail: the runtime's verification function returned `True` because it was verifying *signature validity against a cached root*, not *current registry intent*. Both are "verification," but only the second is what the operator believed they had enforced when they revoked the key. ## Condition of Validity The cold-start cache is only sound under a conjunction of conditions that agent runtimes rarely check explicitly: 1. **Root version monotonicity is enforced on every use, not just on fetch.** The cached root must be accompanied by the registry's current `root_version`, and any use of the cache must confirm `cached_root_version >= registry_current_root_version` is *false* (i.e., you are not behind). If you are behind, the cache is invalid regardless of signature validity. 2. **The cache TTL is bounded by the registry's `snapshot` expiry, not by session lifetime.** TUF snapshot metadata carries an `expires` field. A cache that outlives the snapshot expiry is, by construction, unverifiable — the registry has told you when it stops vouching for that view. 3. **Revocation is observable without a full re-fetch.** Either the registry exposes a lightweight revocation/CRL endpoint the agent polls, or the agent re-fetches root metadata at a cadence shorter than the operator's revocation-to-enforcement SLA. 4. **The manifest digest is re-bound to the resolved tool identity at each invocation.** If the runtime keys its cache by tool *name* rather than `(name, manifest_digest, root_version)`, a rotated manifest under the same name will be silently served from cache. When any of these is false — and in the observed session, conditions 1, 2, and 4 were all false — the cached grant is a **stale capability**, and the agent is executing under a trust decision the registry has already withdrawn. ## Decision Boundary The boundary is not "verify at start vs. verify always." Full re-verification on every tool call is prohibitively expensive (a TUF fetch per invocation adds 40–200ms and a network dependency to every step). The correct boundary is a **two-tier verification with an explicit staleness ceiling**: - **Tier 1 (per-invocation, cheap):** Verify the tool's manifest digest matches the cached `(name, digest, root_version)` triple, and confirm `now < snapshot_expires`. This is a local hash comparison plus a clock check — sub-millisecond. - **Tier 2 (periodic, expensive):** Re-fetch root + snapshot + targets, re-verify the full chain, and invalidate the cache if `root_version` advanced, the signing key changed, or the manifest digest changed. Cadence must be ≤ the operator's revocation SLA (commonly 5–15 min). The decision boundary is crossed — and the agent must **fail closed** rather than proceed — when Tier 1 detects `now >= snapshot_expires` but Tier 2 has not yet completed. In that window the agent must refuse the tool call, not fall back to the cached grant. The observed failure was precisely this: the runtime had no Tier 1 expiry check, so it never entered the fail-closed window; it simply kept passing. A second boundary: when Tier 2 re-fetch returns a *newer* root that no longer trusts the cached key, the agent must treat the in-flight tool call as a **capability withdrawal event** and abort, not complete the call under the old grant. Mid-execution key rotation is the sharp edge — the tool was authorized when the step began and is not authorized when it ends. ## Operational Effect The operational effect of getting this wrong is that revocation is advisory rather than enforced. The registry operator's mental model is "I revoked the key, so no agent will use it." The agent's actual behavior is "I verified the key at cold start, so I will use it until the session ends." The gap between these two models is the entire window between revocation and session termination — in the observed case, 4h 25m and 38 unauthorized egress calls. The blast radius scales with session length, which is exactly the wrong scaling for long-running autonomous agents. The guardrail that bounds it is a **capability lease with an explicit expiry, re-issued by the registry**, rather than a **capability grant cached at cold start**. Concretely: the registry returns a short-lived signed lease (e.g., 10-minute TTL) bound to `(tool, manifest_digest, root_version, expiry)`; the agent presents the lease on each invocation and the runtime refuses calls with expired leases. This converts the trust decision from a point-in-time assertion into a continuously-renewed one, and makes revocation enforcement a matter of lease non-renewal rather than agent cooperation. The cost is one lightweight lease-refresh round-trip per TTL window — bounded, predictable, and independent of session length. ## Operational Checklist for Agent Runtimes - Key the tool cache by `(name, manifest_digest, root_version)`, never by name alone. - Enforce `now < snapshot_expires` on every tool invocation; fail closed on expiry, do not fall back to cache. - Re-fetch root metadata at a cadence ≤ the operator's revocation SLA, and invalidate the cache on any `root_version` advance or key-set change. - Treat mid-execution key rotation as a capability withdrawal: abort the in-flight call, do not complete it under the stale grant. - Prefer registry-issued short-lived capability leases over session-lifetime cached grants for any tool with side effects (egress, filesystem writes, subprocess execution). ```python import hashlib import time from dataclasses import dataclass from typing import Optional class StaleAttestationError(RuntimeError): """Raised when a cached tool attestation is no longer valid at invocation time.""" @dataclass(frozen=True) class CachedGrant: tool_name: str manifest_digest: str root_version: int signing_key_id: str snapshot_expires: float # epoch seconds cached_at: float @dataclass(frozen=True) class RegistryState: current_root_version: int trusted_key_ids: frozenset current_manifest_digest: str def verify_tool_invocation( grant: CachedGrant, registry: RegistryState, now: Optional[float] = None, ) -> bool: """ Tier-1 per-invocation check. Returns True only if the cached grant is still valid against current registry intent. Raises on any staleness. """ now = now if now is not None else time.time() # Invariant 1: snapshot expiry bounds the cache. Fail closed, never fall back. if now >= grant.snapshot_expires: raise StaleAttestationError( f"snapshot for {grant.tool_name} expired at " f"{grant.snapshot_expires:.0f} (now {now:.0f}); " f"refusing invocation pending Tier-2 re-fetch" ) # Invariant 2: cached root must not be behind registry root. if grant.root_version < registry.current_root_version: raise StaleAttestationError( f"cached root_version={grant.root_version} is behind " f"registry root_version={registry.current_root_version} for " f"{grant.tool_name}; cache invalidated" ) # Invariant 3: signing key must still be trusted (revocation check). if grant.signing_key_id not in registry.trusted_key_ids: raise StaleAttestationError( f"signing key {grant.signing_key_id} for {grant.tool_name} " f"has been revoked at root_version={registry.current_root_version}" ) # Invariant 4: manifest digest must match current registry manifest. if grant.manifest_digest != registry.current_manifest_digest: raise StaleAttestationError( f"manifest digest mismatch for {grant.tool_name}: " f"cached={grant.manifest_digest[:12]} " f"registry={registry.current_manifest_digest[:12]}" ) return True def invoke_with_lease( grant: CachedGrant, registry: RegistryState, call_fn, *args, **kwargs, ): """ Wraps a tool call with Tier-1 verification and aborts on staleness. Mid-execution rotation is caught on the next invocation. """ try: verify_tool_invocation(grant, registry) except StaleAttestationError: # Do not complete the call under a withdrawn grant. raise return call_fn(*args, **kwargs) ```