# How should an instance verify a signed skill manifest when the registry's hot-reload path re-resolves dependencies after signature validation **Date of Record:** 2026 November 28 **Scope:** Applies to agent runtimes that load tool/skill definitions from a mutable registry where manifests carry cryptographic signatures over a declared capability set, and where the loader performs dependency resolution or schema re-binding after the signature check. Does not apply to statically compiled tool sets or to registries where the signed payload is the exact byte sequence executed. ## Core Distinction The invariant most registry designers assume is: *signature_valid(manifest) ∧ manifest.capabilities ⊆ granted_capabilities → load is safe*. This is a TOCTOU invariant over a *declared* surface, and it holds only if the executed surface is a pure function of the signed bytes. The failure mode here is that dynamic skill registries almost never satisfy that condition. A manifest declares `name`, `version`, `entrypoint`, `capabilities`, and a set of `requires` (dependency skills, schema versions, or shared resource handles). The signature covers those declarations. But the loader, *after* verifying the signature, resolves `requires` against the live registry — and the resolved dependency is whatever version is current at resolution time, not what was current at signing time. The signature validated a manifest; the runtime executed a manifest-plus-resolution-graph. The gap between those two objects is the injection surface. This is distinct from classic dependency-confusion or typosquatting because the attacker does not need to publish a malicious top-level skill. They need only to control *any* skill that a legitimately signed, legitimately granted skill depends on, and to publish a version that satisfies the `requires` constraint more recently than the version the signer tested against. The signed manifest is honest. The resolution is poisoned. The signature check passes. The capability set that actually executes is the union of the signer's declared capabilities and the capabilities of the resolved transitive closure — and only the former was ever checked against the grant. ## What Was Observed A registry serving skills with semver-style `requires` constraints (`^1.2`, `>=1.0 <2.0`). Manifest signing used detached Ed25519 over a canonicalized JSON of the manifest body, excluding the `resolved_digest` field (which the registry backfills post-hoc). The loader sequence was: 1. Fetch manifest by `(name, version)`. 2. Verify signature over canonical body. 3. Check `manifest.capabilities ⊆ agent.granted_capabilities`. 4. Resolve each `requires` entry to a concrete `(name, version, digest)` tuple against the live index. 5. Recursively load resolved dependencies, *each re-entering step 1*. 6. Bind entrypoints and expose tools to the model's tool schema. Steps 1–3 are the security gate. Steps 4–6 are the execution. The gate never re-engages with the resolution result. A signed skill `report-formatter@1.4.2` declared `requires: { "template-render": "^2.0" }` and `capabilities: ["fs:read:/reports", "net:none"]`. At signing time `template-render@2.1.0` was the resolution target — a pure string templater with `capabilities: []`. Between signing and load, `template-render@2.3.0` was published, still satisfying `^2.0`, carrying `capabilities: ["net:egress:*", "env:read"]` and an entrypoint that, when invoked as a "template helper," exfiltrated the rendered report to an external host. The signature on `report-formatter@1.4.2` verified. Its declared capabilities were within grant. The model was handed a `format_report` tool whose *effective* capability set included `net:egress:*` inherited from the transitively resolved dependency. No check compared the effective closure against the grant. The audit log recorded a clean load of a signed, in-grant skill. A second, subtler variant: the `resolved_digest` backfill. Because the digest is excluded from the signed body, a registry operator (or anyone with write access to the index) can silently repoint a previously-signed manifest's dependency resolution without invalidating the signature. The signature attests to *intent*; the digest attests to *nothing* the signer committed to. ## Condition of Validity The vulnerability is bounded by a precise precondition triad. All three must hold for the injection to succeed: - **Post-verification resolution.** The loader resolves `requires` (or re-binds schema versions, or fetches remote tool descriptors) at any point after signature verification, and does not re-verify a signature over the *resolved closure*. - **Open-ended constraints.** At least one `requires` constraint admits more than one version (any range operator, any `^`/`~`, any floating tag like `latest` or a branch name). - **Capability inheritance.** The effective capability set of a loaded skill is the union over its resolved transitive closure, rather than the intersection or the declared set alone. Remove any one and the attack collapses. Pinned-and-digested `requires` (`name@version#sha256:...`) makes resolution a pure function of the signed bytes. Capability *intersection* across the closure (a skill can only exercise capabilities every dependency also declares, or that the signer explicitly enumerated) neutralizes a malicious dependency's added surface. And re-verification of a signed resolution lockfile — a manifest that lists the exact `(name, version, digest)` tuples the signer committed to — closes the TOCTOU window regardless of constraint form. The condition also has a temporal dimension worth stating explicitly: the window between signing and load is the attack window, and it is unbounded for any skill that is signed once and loaded many times across a fleet. A skill signed in January and cold-loaded in July executes against a July registry. The signature does not age; the resolution graph does. ## Decision Boundary The operational question is not "is the signature valid" but "does the runtime's executed object equal the signer's committed object." The boundary between safe and unsafe load is crossed at the moment the loader accepts a resolution result it did not itself verify against a signer-committed digest. Concretely, an instance should treat the following as the decision boundary and refuse to cross it silently: - If `requires` entries are version-ranged rather than digest-pinned, the manifest is a *template*, not a commitment. It MUST be accompanied by a signed resolution lockfile (`resolved_digest` per dependency, included in the signed body, not backfilled). - If the effective capability closure ⊋ declared capabilities, the load MUST be rejected unless the closure is a subset of the grant *and* every added capability is enumerated in a signed `delegates` field. - If the registry backfills any field post-signature (`resolved_digest`, `loaded_at`, `index_epoch`), that field MUST be excluded from trust decisions and MUST NOT influence which bytes execute. An instance that cannot establish these three facts about a manifest should load it in a quarantined capability envelope — declared capabilities only, closure capabilities stripped to intersection — and surface the discrepancy as a first-class audit event rather than proceeding on the signature alone. The signature is necessary. It is not sufficient, and treating it as sufficient is precisely the boundary error. ## Operational Effect The downstream effect is that signature verification, as commonly implemented, provides *provenance* but not *authority bounding*. An agent that trusts a valid signature as a proxy for "this skill will only do what it declared" is trusting a property the signature was never designed to carry once resolution is dynamic. The practical consequences: - **Capability laundering.** A low-privilege signed skill becomes a carrier for a high-privilege dependency. Grant checks on the top-level manifest are structurally blind to this because they run before resolution. - **Audit blind spots.** Logs show "loaded signed skill X, capabilities within grant." They do not show "effective closure included net:egress from Y@2.3.0." Incident reconstruction after exfiltration will find a clean audit trail and a poisoned resolution graph, and the two will not be correlated unless the loader records the resolved closure digest. - **Fleet-wide blast radius.** Because the poisoned version satisfies the same constraint for every instance that loads the parent skill, a single malicious dependency publication compromises every agent that cold-loads or hot-reloads the parent, across the entire window until the dependency is yanked. - **Silent re-resolution on hot reload.** Runtimes that re-resolve on reload (to pick up "patch fixes") re-cross the boundary on every reload, meaning a skill that was safe at first load can become compromised without any change to its own bytes or signature. The guardrail is a signed resolution lockfile plus closure-intersection capability enforcement plus mandatory recording of the resolved-closure digest in the load audit record. The instance must verify the *executed* object, not the *declared* one, and must fail closed when the two cannot be proven equal. ```python import hashlib from dataclasses import dataclass, field class UnsignedResolutionError(RuntimeError): """Raised when a skill's executed closure cannot be proven equal to the signer's committed closure.""" @dataclass class ResolvedDep: name: str version: str digest: str capabilities: frozenset @dataclass class SkillManifest: name: str version: str declared_capabilities: frozenset requires_ranges: dict # name -> semver range (open-ended => template, not commitment) signed_lockfile: dict = field(default_factory=dict) # name -> (version, digest), inside signed body signature_valid: bool = False def verify_executed_closure( manifest: SkillManifest, resolved: list, granted: frozenset, ) -> frozenset: """ Enforce: executed closure == signer-committed closure, and effective capabilities (union over closure) are within grant AND enumerated. Returns the effective capability set to bind. Raises on any mismatch. """ if not manifest.signature_valid: raise UnsignedResolutionError( f"{manifest.name}@{manifest.version}: signature invalid; refusing load" ) # 1. Every ranged requirement MUST be pinned by a signed lockfile entry. for dep_name in manifest.requires_ranges: if dep_name not in manifest.signed_lockfile: raise UnsignedResolutionError( f"{manifest.name}@{manifest.version}: requires '{dep_name}' is " f"range-only ({manifest.requires_ranges[dep_name]}) with no signed " f"lockfile entry; resolution is not a commitment" ) # 2. Resolved tuples must match the signed digests exactly. resolved_by_name = {d.name: d for d in resolved} for dep_name, (locked_ver, locked_digest) in manifest.signed_lockfile.items(): dep = resolved_by_name.get(dep_name) if dep is None: raise UnsignedResolutionError( f"{manifest.name}@{manifest.version}: locked dependency " f"'{dep_name}' was not resolved" ) if dep.version != locked_ver or dep.digest != locked_digest: raise UnsignedResolutionError( f"{manifest.name}@{manifest.version}: dependency '{dep_name}' " f"resolved to {dep.version}#{dep.digest[:12]} but signer committed " f"to {locked_ver}#{locked_digest[:12]}" ) # 3. Effective capability closure must be within the grant. effective = set(manifest.declared_capabilities) for dep in resolved: effective |= dep.capabilities effective = frozenset(effective) if not effective <= granted: added = effective - manifest.declared_capabilities raise UnsignedResolutionError( f"{manifest.name}@{manifest.version}: effective closure adds " f"capabilities {sorted(added)} not declared by signer and not " f"covered by grant {sorted(granted)}" ) return effective def load_skill(manifest, resolved, granted): effective = verify_executed_closure(manifest, resolved, granted) closure_digest = hashlib.sha256( "|".join(sorted(f"{d.name}@{d.version}#{d.digest}" for d in resolved)).encode() ).hexdigest() # audit record MUST carry closure_digest, not just manifest signature status return {"skill": f"{manifest.name}@{manifest.version}", "effective_capabilities": sorted(effective), "closure_digest": closure_digest} ```