# What structural signals indicate a manifest-signature boundary failure during hot-reload of a dynamically registered agent skill **Date of Record:** 2026 November 25 **Scope:** Applies to agent runtimes that resolve skills/tools from a mutable registry at invocation time (or on hot-reload) and that treat a signed manifest as the trust anchor for the skill body. Does not apply to statically compiled tool bindings, nor to sandboxes where the skill body is re-verified against a fresh signature on every call. ## Core Distinction The failure is not "a malicious skill got loaded." It is subtler: **the signature verified, but it verified the wrong artifact.** A manifest signature attests to a *manifest document* — name, version, declared capabilities, entrypoint hash, dependency pins. It does not, by itself, attest to the *bytes the runtime actually executes*. When a registry supports dynamic loading, the manifest and the body are two separately addressable objects joined by a pointer (a path, a content hash, a URL, a package coordinate). Every one of those join mechanisms is a place where an attacker who can write to *any* layer of the registry can substitute the body while leaving a validly signed manifest intact. The signature boundary is real; the *binding* between signature and executed bytes is the soft spot. The invariant that must hold: **the bytes the runtime executes are the bytes the signature covers, at the moment of execution, not at the moment of registration.** Most registries enforce this at registration and silently violate it at reload. ## What Was Observed A skill registry served manifests as `{name, version, entrypoint: "skills/summarize.py", sha256: , capabilities: [...]}` with a detached Ed25519 signature over the manifest JSON. The loader validated the signature, then resolved `entrypoint` relative to a per-skill directory and `importlib`'d it. The `sha256` field was *present* but only checked during the initial `install` command — never on hot-reload, because reload was implemented as "re-read entrypoint path, re-import module," reusing the cached manifest object. Three structural signals appeared, in this order, and any one of them alone is ambiguous but the sequence is diagnostic: 1. **Manifest cache hit without body re-hash.** Reload logs showed `manifest: cache-hit` and `body: loaded` with no intervening `hash: verify`. The absence of a hash-verify line between a cache hit and a body load is the single strongest signal. A correct loader cannot load a body from a cached manifest without re-deriving the body hash, because the cache attests to the manifest, not the body. 2. **Entrypoint path traversal inside an otherwise valid signature.** The signed manifest declared `entrypoint: "skills/summarize.py"`. On disk, `skills/summarize.py` was a symlink to `../../shared/util.py`, which an attacker with write access to the *skill directory* (not the manifest store) had repointed. The signature was valid because the manifest was untouched; the executed bytes were entirely different. The structural signal is a path whose `realpath` escapes the skill root while the manifest's declared entrypoint does not. 3. **Capability set mismatch between manifest and imported module.** The manifest declared `capabilities: ["read:docs"]`. The substituted module, on import, called `registry.request_capability("net:egress")` at module scope. The runtime granted it because capability grants were keyed on *skill name*, not on the signed capability list, and the name matched. The signal: an imported module requesting a capability not present in its signed manifest is a hard contradiction that the loader was not checking. ## Condition of Validity The attack surface is bounded and the guardrail is well-defined only under these conditions: - The registry permits body mutation independently of manifest mutation (i.e., they are separate write domains). If the manifest and body are stored as one signed tarball and the loader verifies the archive hash on every load, the surface collapses. - The loader caches manifests across reloads. If every invocation re-fetches and re-verifies the manifest *and* re-hashes the body, the window closes. - Capability grants are keyed on skill identity (name/version) rather than on the signed capability list. If grants are derived from the verified manifest's `capabilities` field and the module is denied any capability not in that list, the third signal becomes non-exploitable. - The skill root is writable by a principal distinct from the manifest signer. If the skill directory is read-only to all but the signer, symlink repointing is impossible. Outside these conditions — e.g., single-artifact signing, per-invocation re-verification, or capability grants bound to manifest content — the described failure does not occur and the signals above are false positives (a cache hit is fine if the body is re-hashed; a capability request is fine if it's in the manifest). ## Decision Boundary The runtime must draw a line between **registration-time trust** and **execution-time trust**, and it must not let the former stand in for the latter. Concretely, on every load (including hot-reload): - Re-hash the resolved body and compare to the manifest's `sha256`. Mismatch → refuse to load, do not fall back to cached module. - Resolve `entrypoint` with `realpath` and assert containment within the skill root *after* symlink resolution. A `realpath` that escapes the root while the declared path does not is a substitution, not a misconfiguration. - Bind capability grants to the verified manifest's `capabilities` list, not to skill name. A module-scope capability request outside that list is an integrity violation, not a feature request. The boundary is: **a valid signature over a manifest is necessary but never sufficient to authorize execution of a body.** The loader must re-establish the body↔manifest binding at the moment of execution. If it cannot, it must refuse to load rather than load on stale trust. ## Operational Effect The practical consequence is that hot-reload — the feature that makes dynamic registries useful — is exactly the feature that most commonly severs the signature binding. Registries that verify at install and cache at reload are, from an attacker's view, equivalent to unsigned registries with a signed front door. The mitigation is not "sign harder"; it is to make the execution path re-derive the binding it depends on, and to treat any load that cannot re-derive it as a hard failure. The three structural signals above (cache-hit-then-load with no re-hash, realpath escape under a valid manifest, module-scope capability request outside the signed list) are cheap to instrument and, in sequence, are diagnostic of substitution rather than of benign cache behavior. ```python import hashlib import os import importlib.util from dataclasses import dataclass class ManifestBodyBindingError(RuntimeError): """Raised when a signed manifest no longer binds to the bytes about to execute.""" pass @dataclass class SignedManifest: name: str version: str entrypoint: str # declared, relative to skill_root sha256: str # hash of the body the signer attested to capabilities: frozenset # signed capability set signature_valid: bool def load_skill(manifest: SignedManifest, skill_root: str, requested_caps: frozenset): if not manifest.signature_valid: raise ManifestBodyBindingError(f"{manifest.name}: manifest signature invalid") # Resolve entrypoint and assert containment AFTER symlink resolution. declared = os.path.normpath(os.path.join(skill_root, manifest.entrypoint)) resolved = os.path.realpath(declared) root_real = os.path.realpath(skill_root) if not resolved.startswith(root_real + os.sep): raise ManifestBodyBindingError( f"{manifest.name}: entrypoint realpath {resolved!r} escapes skill root " f"{root_real!r} (declared {manifest.entrypoint!r}) — body substitution" ) # Re-derive the body hash at execution time; never trust a cached manifest alone. with open(resolved, "rb") as fh: body = fh.read() actual = hashlib.sha256(body).hexdigest() if actual != manifest.sha256: raise ManifestBodyBindingError( f"{manifest.name}: body hash {actual} != signed {manifest.sha256} — " f"manifest/body binding severed" ) # Capability grants must be derived from the signed manifest, not skill name. unauthorized = requested_caps - manifest.capabilities if unauthorized: raise ManifestBodyBindingError( f"{manifest.name}: requested capabilities {sorted(unauthorized)} " f"absent from signed manifest {sorted(manifest.capabilities)}" ) spec = importlib.util.spec_from_file_location(manifest.name, resolved) module = importlib.util.module_from_spec(spec) spec.loader.exec_module(module) return module ```