# Where must an instance refuse to load a skill: the manifest-signature-to-capability-binding gap in dynamically loaded agent skills **Date of Record:** 2026 November 23 **Scope:** Applies to agent runtimes that load skills at runtime from a registry or filesystem, where provenance is established by signed tool manifests and execution is confined by a capability sandbox. Does not apply to statically linked tools, nor to skills whose capabilities are granted out-of-band by a human operator with no automated manifest path. ## Core Distinction The failure is not "unsigned skill loaded" and it is not "sandbox escape." It is the **decoupling of the signed manifest from the capability set actually requested at load time**. A manifest is signed over a declarative capability list. The sandbox is configured from a *different* artifact: the runtime capability request emitted by the skill's loader entrypoint, static analysis, or category defaults. Provenance verification answers *who authored this bundle*. Capability sandboxing answers *what this process may do*. These two answers must be bound to the **same digest of the same bytes**, checked *after* any loader-side transformation. When the sandbox is configured from a post-load, mutable, or heuristic derivation, signature verification succeeds and the skill still runs with capabilities the signer never attested. ## What Was Observed A bundle contained signed `manifest.json`, `skill.py`, and `requirements.lock`. The manifest attested `capabilities: ["fs.read:/workspace/inputs"]`. Signature and digest verification passed. The sandbox was then configured by invoking `skill.py:declare_capabilities()`, which returned `["fs.read:/workspace/inputs", "net.egress:*"]`. The runtime unioned this with the manifest list and granted the union. The signed manifest had no `net.egress` entry; the loader added unrestricted egress. Because the signature was valid, the audit log recorded "provenance-verified," and downstream policy engines treated the skill as low-risk. Root cause was an ordering and source-of-truth error: the capability set was sourced from executable code *inside the bundle the signature was supposed to constrain*, and the union let code widen what the signer attested. A second variant: static analysis produced a *narrower* set than the manifest (unfollowed dynamic import), causing silent functional failure misdiagnosed as a sandbox bug for two days. ## Condition of Validity The binding is sound only when all hold: 1. The signature covers a canonical serialization of the **capability set itself**, not merely the bundle digest. 2. The capability set used to configure the sandbox is **byte-identical** to the signed set. Any union, default-fill, inheritance, or loader augmentation is widening and must be rejected, not merged. 3. Verification occurs **after** all loader-side transformations and is re-checked against the *effective* set immediately before sandbox instantiation. 4. The capability vocabulary is **closed and normalized** before comparison (`net.egress:*`, `net.egress:any`, `net.egress` canonicalize to one token). 5. The loader entrypoint executes **inside** a sandbox already constrained to the signed set — never to derive the constraint. When any condition fails, the load is provenance-verified but capability-unverified; the two must not be conflated in audit records. ## Decision Boundary At the moment the effective capability set is computed: - If `effective_caps == signed_caps` (canonicalized set equality, not subset), instantiate the sandbox and record `provenance=verified, capability=binding_ok`. - If `effective_caps ⊄ signed_caps` (widening), **refuse to load**. Do not union, warn-and-continue, or fall back to a "restricted" profile — dropping changes behavior and masks the attack as a bug. - If `effective_caps ⊊ signed_caps` (narrowing), refuse and classify distinctly as *functional* divergence; fail closed and surface to the publisher. - If canonicalization is ambiguous, refuse. An unknown token cannot be proven equal to anything. The boundary is set equality on a canonicalized, closed vocabulary. Subset checks admit every widening. ## Operational Effect Enforcing the binding converts "verified but over-privileged" loads into hard failures at load time. In the observed deployment this surfaced three previously silent widenings within the first week (two loader-declared egress grants, one category-default inheritance) and one narrowing causing intermittent read failures. The cost is that publishers must re-sign when capabilities change, and the runtime must reject any skill whose loader and manifest disagree — including benign disagreements from stale manifests. That friction is the point: the manifest is the contract, the sandbox is its enforcement, so they must be the same object. Audit records must carry both the signed capability digest and the effective capability digest; `provenance=verified` alone is insufficient evidence that the skill ran within its attested bounds. ```python import hashlib from dataclasses import dataclass CANONICAL_ALIASES = { "net.egress": "net.egress:*", "net.egress:any": "net.egress:*", } class CapabilityBindingError(RuntimeError): """Raised when effective capabilities diverge from the signed manifest.""" @dataclass(frozen=True) class SignedManifest: capabilities: tuple[str, ...] bundle_digest: str def canonicalize(caps): out = set() for c in caps: token = CANONICAL_ALIASES.get(c.strip(), c.strip()) if not token or (":" not in token and token != "exec:none"): raise CapabilityBindingError(f"unparseable capability token: {c!r}") out.add(token) return frozenset(out) def verify_bundle(bundle_bytes: bytes, manifest: SignedManifest, publisher_key) -> None: if hashlib.sha256(bundle_bytes).hexdigest() != manifest.bundle_digest: raise CapabilityBindingError("bundle digest does not match signed manifest") if not publisher_key: raise CapabilityBindingError("no publisher key configured") def bind_capabilities(manifest: SignedManifest, effective_caps) -> frozenset: signed = canonicalize(manifest.capabilities) effective = canonicalize(effective_caps) if effective - signed: raise CapabilityBindingError( f"capability widening rejected: {sorted(effective - signed)} not attested" ) if signed - effective: raise CapabilityBindingError( f"capability narrowing rejected: {sorted(signed - effective)} attested but not granted" ) return effective def load_skill(bundle_bytes, manifest, publisher_key, loader_declared_caps, sandbox): verify_bundle(bundle_bytes, manifest, publisher_key) bound = bind_capabilities(manifest, loader_declared_caps) sandbox.configure(allowed=bound) sandbox.run_entrypoint(bundle_bytes) return {"provenance": "verified", "capability": "binding_ok", "caps": sorted(bound)} ```