# When must an instance reject a tool manifest whose declared capabilities drift after signature verification **Date of Record:** 2026 November 22 **Scope:** Applies to agent runtimes that load tool manifests dynamically (MCP servers, plugin registries, skill bundles) and verify them via signature at load time, then re-read or re-resolve manifest fields at invocation time. Does not apply to statically compiled tool sets whose schemas are frozen with the binary, nor to runtimes that re-verify the full manifest hash on every call. ## Core Distinction The failure we are isolating is not "unsigned manifest accepted" and not "malicious manifest authored by an attacker." It is **post-verification capability drift**: a manifest that passes signature verification at `t0`, but whose *effective* capability surface at invocation time `t1` is larger than what the signature attested. The signature binds bytes; the runtime binds behavior. When those two diverge, the signature becomes a false attestation of safety rather than a proof of it. Two things must be separated clearly: - **Schema-valid drift** — the manifest is re-fetched or re-parsed and the `capabilities`, `scopes`, or `side_effects` fields change while the signature block is unchanged (because the signer signed a *pointer* or a *version tag* rather than the content). - **Semantic drift under a stable schema** — the bytes are identical, but a field whose meaning the runtime interprets loosely (e.g., `"path_glob": "*"`, `"env": ["*"]`, `"allowed_hosts": null`) resolves to a broader grant at call time than the signer intended, because the *interpreter* changed or the *default* changed. The second is the non-obvious one. The bytes verified fine. The signature is valid. And yet the agent now holds a capability the signer never granted. ## What Was Observed A skill bundle was registered with a manifest declaring a single tool `read_file` with `"path_scope": "${WORKSPACE}"` and a detached signature over the manifest digest. At registration, `${WORKSPACE}` resolved to `/srv/agents/a17/workspace`, and the digest was computed over the *resolved* form. The runtime cached the resolved manifest, verified the digest, and admitted the tool. At the next cold start, the supervisor process changed the interpolation contract: `${WORKSPACE}` was now resolved *after* digest verification, and the digest was computed over the *unresolved* template. The manifest bytes had not changed. The signature was still valid. But the tool now resolved `${WORKSPACE}` against the *supervisor's* environment, which for a shared worker pool pointed at `/srv/agents/shared`. The `read_file` tool inherited read access to every sibling agent's workspace. The trigger condition was precise: **the digest was computed over one representation of the manifest while the capability was resolved from a different representation, and the two representations were not provably equivalent.** The signature attested the template; the runtime executed the resolution. Nothing in the verification path checked that resolution was a pure function of the signed bytes. The failure trace: 1. `load_manifest(bundle)` → returns template `T` with `${WORKSPACE}` literal. 2. `verify(sig, digest(T))` → OK. Signature binds `T`. 3. `resolve(T, env)` → returns `R` with `path_scope = /srv/agents/shared`. 4. `grant(R.path_scope)` → grants read on shared root. 5. Agent invokes `read_file("/srv/agents/b02/workspace/creds.env")` → succeeds. No step was individually wrong. The composition was. The signature was over `T`; the grant was over `R`; and no invariant required `R` to be derivable from `T` alone. ## Condition of Validity A signature over a manifest is a valid attestation of capability **only if** the following invariant holds: > For every manifest field that influences capability resolution, the resolved value at invocation time is a deterministic function of the signed bytes and a *signed, immutable* environment binding. In practice this decomposes into three checkable conditions: 1. **Resolution purity.** `resolve(T, env)` must not read mutable process state (env vars, cwd, hostname, clock, user identity) unless that state is itself captured in the signed payload. If `${WORKSPACE}` appears, the resolved value must be a signed field `"workspace": "/srv/agents/a17/workspace"`, not a runtime interpolation. 2. **Digest coverage.** The digest must cover the *resolved* manifest, or the runtime must verify `digest(resolve(T, env))` at every invocation, not just at load. 3. **Interpreter versioning.** The resolver itself must be versioned and its version included in the signed payload, because a resolver change is a capability change. A manifest signed under resolver `v1` and executed under resolver `v2` is a different grant even if the bytes are identical. A manifest that fails any of these is not "verified." It is *partially verified*, and the unverified portion is exactly the portion that grants access. ## Decision Boundary The runtime must decide, at load time and again at invocation time, whether to admit the tool. The boundary is not "is the signature valid" — it is **"is the signed artifact the same artifact that will execute."** Concretely, the decision rule is: - If `resolve` is pure over signed fields and the resolver version is signed → **admit**, and cache the resolved form keyed by `(digest, resolver_version, signed_env)`. - If `resolve` reads any unsigned mutable state → **reject at load** with a `CapabilityDriftError`, because the signature cannot bound the grant. - If the runtime cannot prove resolver version stability across restarts → **reject**, because a cold start may execute the same bytes under a different interpreter and produce a different grant. The non-obvious part: the second and third cases look like *valid* manifests. The signature checks out. A naive loader admits them. The correct loader refuses them, and the refusal is not because the signature is bad but because the signature is *insufficient* — it attests bytes, and the runtime needs it to attest behavior. This is why the boundary is sharp and easy to miss: **a valid signature is necessary but not sufficient, and the sufficiency condition is not visible from the signature alone.** It requires the runtime to reason about its own resolver. ## Operational Effect Agents that skip this invariant exhibit a specific, reproducible failure signature: - **Silent privilege escalation on restart.** The first boot is clean; the second boot, after a supervisor config change, grants broader access. No error is logged because no check failed — the checks that ran were the wrong checks. - **Cross-tenant bleed in shared pools.** Because `${WORKSPACE}`-style interpolation resolves against the pool environment, one agent's tool reads another's state. This is indistinguishable from a legitimate read at the tool layer. - **Signature laundering.** An auditor sees "signature valid, digest matches" and concludes the grant was attested. It was not. The digest matched a template; the grant was resolved from an environment the signer never saw. The guardrail is architectural, not procedural: **the runtime must treat the resolver as part of the trusted computing base and must sign its version alongside the manifest.** A manifest whose capability fields contain unresolved interpolations must be rejected unless the interpolation bindings are themselves signed fields. "Signed template, runtime-resolved grant" is not a weaker form of verification — it is the absence of verification wearing its clothes. The following check enforces the invariant at load and re-checks it at invocation, refusing any manifest whose capability surface is not a pure function of signed bytes. ```python import hashlib import json from dataclasses import dataclass from typing import Any, Mapping class CapabilityDriftError(RuntimeError): """Raised when a manifest's effective capability surface is not a deterministic function of its signed bytes. The signature may be valid; the grant is nonetheless unattested and must be refused.""" @dataclass(frozen=True) class SignedManifest: payload: Mapping[str, Any] # the bytes the signature covers digest: str # digest over canonical(payload) resolver_version: str # MUST be inside payload to be trusted _MUTABLE_INTERPOLATIONS = ("${WORKSPACE}", "${HOME}", "${CWD}", "${HOST}") def _canonical(payload: Mapping[str, Any]) -> bytes: return json.dumps(payload, sort_keys=True, separators=(",", ":")).encode() def _capability_fields(payload: Mapping[str, Any]) -> list[str]: # fields that influence what the tool can touch keys = ("path_scope", "allowed_hosts", "env", "side_effects", "scopes") return [k for k in keys if k in payload] def admit_manifest(m: SignedManifest, expected_resolver_version: str) -> Mapping[str, Any]: # 1. digest must cover the payload we are about to reason over if hashlib.sha256(_canonical(m.payload)).hexdigest() != m.digest: raise CapabilityDriftError("digest does not cover the payload being admitted") # 2. resolver version must be signed, not inferred from the runtime signed_resolver = m.payload.get("resolver_version") if signed_resolver is None: raise CapabilityDriftError( "resolver_version absent from signed payload; grant is unattested" ) if signed_resolver != expected_resolver_version: raise CapabilityDriftError( f"resolver drift: signed={signed_resolver!r} runtime={expected_resolver_version!r}" ) # 3. capability fields must not contain unresolved mutable interpolations for field in _capability_fields(m.payload): value = m.payload[field] rendered = json.dumps(value) for token in _MUTABLE_INTERPOLATIONS: if token in rendered: raise CapabilityDriftError( f"capability field {field!r} contains unresolved {token}; " "resolved grant would not be a function of signed bytes" ) # 4. re-verify at invocation time: caller must pass the same manifest object return m.payload def invoke_tool(m: SignedManifest, tool: str, args: Mapping[str, Any], expected_resolver_version: str) -> Any: payload = admit_manifest(m, expected_resolver_version) tools = payload.get("tools", {}) if tool not in tools: raise CapabilityDriftError(f"tool {tool!r} not in signed manifest") # ... dispatch to sandboxed executor using payload-derived scope only ... return {"tool": tool, "args": args, "scope": payload.get("path_scope")} ```