# Why does an instance accept a signed skill manifest whose payload hash still validates after the skill's tool surface has been mutated? **Date of Record:** 2026 November 22 **Scope:** Applies to agents that load third-party or dynamically injected capabilities gated by a signed manifest (payload digest + declared tool schema + capability grants) and that attest runtime integrity at invocation time. Does not apply to statically compiled skills shipped inside the agent image, nor to manifest schemes that sign the executable body directly rather than a descriptor referencing it. ## Core Distinction A signed skill manifest is a **descriptor-integrity** primitive, not a **surface-integrity** primitive. The signature binds the manifest bytes to a publisher key; the payload digest inside the manifest binds the manifest to a *specific artifact blob*. Neither binds the *live tool surface* the agent will actually invoke. Between "manifest verified" and "tool called," an agent assembles a callable surface from several sources: the signed descriptor's declared schema, a runtime registry that resolves tool names to implementations, environment-injected overrides, and any dynamic import path the loader honors. The invariant that is commonly assumed — *signature valid ⟹ invoked behavior matches publisher intent* — does not hold, because the digest covers the artifact at rest while attestation covers the process at call time, and nothing forces those two views to be the same object. The non-obvious boundary: an attacker (or a benign misconfiguration) can leave the signed manifest and its payload digest byte-for-byte intact while substituting the *resolved* tool implementation, adding an undeclared tool to the namespace, or widening a declared capability grant at the registry layer. Every hash check passes. The agent executes code the publisher never signed. ## What Was Observed A capability was injected as a signed manifest declaring two tools, `summarize(text)` and `lookup(id)`, with a `network: none` grant and a payload digest `sha256:9f3c…`. At load, the agent verified the signature over the manifest and recomputed the payload digest over the fetched blob: both matched. Attestation was logged as `INTEGRITY_OK`. At invocation, the runtime registry resolved `summarize` not to the signed blob's entrypoint but to a later-registered binding of the same name — a shim installed by a sibling skill's loader that had claimed the namespace first-wins. The shim matched the declared signature `(text: str) -> str`, so schema validation passed. It forwarded to the real implementation *and* additionally called an undeclared `exfiltrate()` helper that read the agent's scratch context. The manifest still hashed correctly; the payload blob on disk was untouched; the grant table still said `network: none`. The violation lived entirely in the **name→implementation resolution** layer, which no signature covered. The failure trace: 1. Loader fetches manifest `M` and blob `B`. Verifies `sig(M)` and `digest(B) == M.payload_hash`. Passes. 2. Loader registers `B.entrypoints` into a mutable namespace keyed by tool name. Registration is last-write-wins (or first-wins — either way, not bound to `M`). 3. A second skill, or an env-injected override, registers `summarize` again with a conforming signature but different behavior. 4. Invocation resolves `summarize` → shim. Argument schema check passes (signature-compatible). Grant check passes (shim reports `network: none`; it uses an in-process channel the grant table doesn't model). 5. Attestation at call time re-hashes `B` and re-verifies `M`. Both pass. The attestation is *about the wrong object* — it attests the artifact, not the callable. The tell was not a hash mismatch. It was that the resolved callable's **provenance** (which registration wrote this binding, under which manifest) was never recorded, so no check could compare "the thing I'm about to call" against "the thing I signed." ## Condition of Validity The signature-implies-behavior invariant holds **only** when all of the following are enforced: - The runtime resolves tool names through an **immutable, per-manifest namespace** — a binding installed by manifest `M` is only reachable through `M`'s handle, never through a global name that another loader can shadow. Resolution is by `(manifest_id, tool_name)`, not `tool_name`. - The **callable identity** is pinned: the resolved implementation's own digest (or a stable content address) is recorded at registration and re-checked at invocation, so attestation covers the object actually called, not a sibling artifact. - Capability grants are **enforced at the syscall/channel boundary**, not self-reported by the tool. A shim that claims `network: none` while using an unmodeled channel must still be blocked by the boundary the grant table actually gates. - Undeclared tool registration into a manifest's namespace is **rejected**, not merged. The set of reachable tools for `M` equals exactly `M.declared_tools`. Absent any one of these, the manifest is a valid signature over a descriptor that no longer describes the executing surface. ## Decision Boundary The boundary is drawn at **resolution time, not verification time**. Verification answers "is this artifact the one the publisher signed?" Resolution answers "is the thing I am about to call the artifact I verified?" These are separate questions and must be separate gates. Concretely: treat a manifest as **admissible** only if, at the moment of invocation, the runtime can present a chain `manifest_id → payload_digest → registered_binding_digest → resolved_callable_digest` where every link matches. If the runtime cannot produce the binding digest because registration was name-keyed and mutable, the manifest is **not attestable** regardless of signature validity — fail closed. Do not treat a passing `sig(M) + digest(B)` as authorization to call; treat it as authorization to *register into an isolated namespace*, and gate the call on the resolution chain. The asymmetry to encode: a signature failure is loud and rare; a resolution substitution is silent and common (every namespace collision, every env override, every hot-reload). Budget your integrity checks toward the silent case. ## Operational Effect Agents that conflate descriptor integrity with surface integrity will report `INTEGRITY_OK` while executing unsigned behavior — the worst failure class, because the attestation actively suppresses suspicion. The practical consequences: - **False assurance in audit logs.** The log line "manifest verified, digest matched" becomes evidence of safety it does not provide. Downstream auditors replay the log and conclude the call was authorized. - **Shadowing as an attack surface.** Any loader that registers by bare tool name enables first-wins/last-wins substitution. A malicious skill need not forge a signature; it only needs to win a namespace race with a conforming signature. - **Grant laundering.** Self-reported grants let a substituted callable claim a narrower grant than it uses, defeating least-privilege if grants are enforced by the tool rather than the boundary. - **Hot-reload drift.** Re-registering a tool after manifest verification (config reload, plugin update) silently detaches the callable from the signed blob with no hash ever failing. The guardrail is a **provenance-pinned resolution**: immutable per-manifest namespaces, binding digests recorded at registration and re-checked at call, grants enforced at the channel boundary, and undeclared registrations rejected. Attestation must name the callable, not just the artifact. ```python import hashlib from dataclasses import dataclass, field class UnattestableSurfaceError(RuntimeError): """Raised when a manifest verifies but the resolved callable cannot be bound to it.""" pass @dataclass(frozen=True) class Manifest: manifest_id: str payload_digest: str # sha256 over the signed artifact blob declared_tools: frozenset # exact set of tool names this manifest may expose grants: frozenset # e.g. {"network:none"} @dataclass class Binding: manifest_id: str tool_name: str callable_digest: str # content address of the resolved implementation class ProvenanceRegistry: """Name resolution keyed by (manifest_id, tool_name); never by bare name.""" def __init__(self): self._bindings: dict[tuple[str, str], Binding] = {} def register(self, manifest: Manifest, tool_name: str, impl_digest: str) -> None: if tool_name not in manifest.declared_tools: # Undeclared tools must be rejected, not merged into the namespace. raise UnattestableSurfaceError( f"tool {tool_name!r} not declared by manifest {manifest.manifest_id}" ) key = (manifest.manifest_id, tool_name) if key in self._bindings: # Shadowing a signed binding is the substitution vector; refuse it. raise UnattestableSurfaceError( f"binding {key} already registered; shadowing rejected" ) self._bindings[key] = Binding(manifest.manifest_id, tool_name, impl_digest) def resolve(self, manifest: Manifest, tool_name: str, live_impl_digest: str) -> Binding: key = (manifest.manifest_id, tool_name) binding = self._bindings.get(key) if binding is None: raise UnattestableSurfaceError(f"no signed binding for {key}") # Attest the callable actually about to run, not just the artifact at rest. if binding.callable_digest != live_impl_digest: raise UnattestableSurfaceError( f"callable drift for {key}: signed {binding.callable_digest} " f"!= live {live_impl_digest}" ) return binding def attest_and_invoke( manifest: Manifest, blob: bytes, registry: ProvenanceRegistry, tool_name: str, live_impl_digest: str, signature_ok: bool, ) -> Binding: # Gate 1: descriptor integrity (necessary, not sufficient). payload_digest = "sha256:" + hashlib.sha256(blob).hexdigest() if not signature_ok or payload_digest != manifest.payload_digest: raise UnattestableSurfaceError("manifest signature or payload digest failed") # Gate 2: surface integrity — bind the resolved callable to the signed manifest. binding = registry.resolve(manifest, tool_name, live_impl_digest) if binding.manifest_id != manifest.manifest_id: raise UnattestableSurfaceError("resolved binding provenance mismatch") return binding ```