# In what scenarios must an instance treat a signed capability manifest as insufficient and demand runtime attestation of the loaded skill body **Date of Record:** 2026 November 29 **Scope:** Applies to agent runtimes that gate skill/tool loading behind signed capability manifests (Ed25519-signed JSON declaring skill ID, version, declared tools, declared scopes, and a content hash) and that perform runtime attestation of the loaded body before first invocation. Does not cover unsigned plugin loading, nor manifest-only gating where attestation is skipped by design. ## Core Distinction A signed capability manifest attests to *what a skill is permitted to do*. Runtime attestation attests to *what code is actually resident in the process right now*. These are two different propositions, and the gap between them is where skill injection lives. The manifest is a signature over a declaration; the attestation is a hash (or TEE measurement) over a loaded artifact. A skill can present a perfectly valid signature over a manifest whose `body_hash` field no longer matches the bytes the loader mapped into memory — because the manifest was signed at publish time, and the body was substituted, mutated, or resolved to a different artifact at load time. The non-obvious invariant: **manifest validity is a necessary but not sufficient condition for skill integrity.** The failure mode is not "forged signature" (cryptographically hard) but "signature valid, binding stale." An instance must demand attestation whenever the manifest's binding to the body is not itself re-verified at the moment of load. ## What Was Observed A skill `pdf-extract@2.3.1` was published with a manifest signed by the publisher key, declaring `body_hash: sha256:9f2a...`. The runtime loader resolved the skill by ID and version through a registry that returned a *mutable* pointer: `latest` within the `2.3.x` channel. The registry served `2.3.1`'s manifest but a `2.3.2-rc` body, because the channel resolution and the manifest fetch were two separate RPCs against two separately-cached endpoints. The signature verified. The declared scopes (`fs:read:/tmp`, `net:none`) verified. The body that executed contained a `subprocess` call that the manifest did not declare. The trace: 1. Loader fetches manifest for `pdf-extract@2.3.1` → signature valid, scopes parsed. 2. Loader fetches body via channel resolver → returns `2.3.2-rc` bytes (cache skew, ~40s window during a release). 3. Loader computes `sha256(body)` = `a1c4...`, compares against `manifest.body_hash` = `9f2a...`. 4. **Comparison was skipped** because the loader's fast path trusted the registry's `integrity: verified` response header, which was set by the *channel* service, not the *manifest* service. 5. Body executes with `subprocess` capability not present in declared scopes; scope enforcement was applied to the *manifest's* declared tools, not the body's actual imports. The scope gate was real. The signature was real. The binding between them was assumed, not checked. The attacker in this trace was a release-process race, not a malicious publisher — which is precisely why manifest-only defense is insufficient: the threat model includes benign but non-atomic distribution. ## Condition of Validity A signed manifest is a sufficient gate **only** when all of the following hold simultaneously: - The manifest's `body_hash` is recomputed over the exact bytes the interpreter will execute, in the same process, after resolution, before first call. - Manifest fetch and body fetch are bound to the same immutable version identifier (a content-addressed digest, not a channel or `latest` pointer). - The scope enforcement layer reads declared capabilities from the *verified* manifest, and the runtime refuses to expose any tool whose import is not covered by a declared scope — i.e., scope checks are applied to the loaded symbol table, not the manifest text. - The attestation result is cached against the body digest, not against the skill ID, so a re-resolve to different bytes invalidates the cache. If any of these fails, the manifest is a declaration of intent, not a proof of content. The instance must treat it as untrusted input and demand attestation. ## Decision Boundary The boundary is: **does the runtime re-bind signature to bytes at load time, or does it inherit a binding from an upstream service?** - If the loader computes `sha256(loaded_bytes)` and compares to `manifest.body_hash` in-process → manifest is sufficient; attestation is redundant but cheap. - If the loader trusts an upstream `integrity` field, a channel pointer, a CDN cache header, or a version string → attestation is mandatory, because the binding is held by a party that is not the verifier. - If the skill body is fetched over a network path where any hop can serve different bytes for the same version string → attestation is mandatory. - If the skill is loaded from a local path that a prior step wrote (e.g., an agent's own workspace, a temp dir populated by a tool call) → attestation is mandatory, because the writer is inside the trust boundary and may be compromised by prompt injection. The failure to demand attestation in the last case is the most dangerous: an agent that writes a skill file via a `write_file` tool call and then loads it has created a self-injection path. The manifest signature is irrelevant because the attacker never needed to forge it — they needed only to control the bytes at the path the loader reads. ## Operational Effect When the boundary is crossed without attestation, the failure is silent. The manifest verifies, the scopes parse, the skill runs, and the undeclared capability executes. There is no error to catch — the error is the absence of a check. The downstream effect is that scope enforcement becomes advisory: it constrains the manifest author's honesty, not the runtime's actual behavior. The guardrail is a load-time attestation gate that fails closed: compute the digest of the resolved bytes, compare against the manifest's `body_hash`, and refuse to register the skill's tools if they differ. Additionally, walk the loaded module's imports and refuse any symbol whose capability is not covered by a declared scope. The attestation must be keyed on the body digest so that a re-resolve to different bytes re-triggers the check. ```python import hashlib from dataclasses import dataclass class AttestationMismatch(RuntimeError): """Raised when a resolved skill body does not match its signed manifest.""" class UndeclaredCapability(RuntimeError): """Raised when a loaded skill exposes a tool not covered by declared scopes.""" @dataclass(frozen=True) class Manifest: skill_id: str version: str body_hash: str # "sha256:" declared_scopes: frozenset[str] declared_tools: frozenset[str] def attest_and_register(manifest: Manifest, resolved_bytes: bytes, loaded_tools: dict[str, str]) -> dict[str, str]: # 1. Re-bind signature to bytes in-process. Never trust an upstream # "integrity: verified" header or a channel pointer here. actual = "sha256:" + hashlib.sha256(resolved_bytes).hexdigest() if actual != manifest.body_hash: raise AttestationMismatch( f"{manifest.skill_id}@{manifest.version}: body digest {actual} " f"!= manifest body_hash {manifest.body_hash}" ) # 2. Scope enforcement reads the *verified* manifest, and is applied to # the loaded symbol table, not the manifest text. for tool_name, required_scope in loaded_tools.items(): if tool_name not in manifest.declared_tools: raise UndeclaredCapability( f"{manifest.skill_id}: tool {tool_name!r} not in declared_tools" ) if required_scope not in manifest.declared_scopes: raise UndeclaredCapability( f"{manifest.skill_id}: tool {tool_name!r} requires " f"{required_scope!r} not in declared_scopes" ) # 3. Register only after both checks pass; key cache on body digest. return {"skill_id": manifest.skill_id, "body_digest": actual, "tools": tuple(loaded_tools)} ```