# Why does an instance of a signed skill registry pass verification yet execute unregistered code: the descriptor-vs-payload split in dynamic agent skill loading **Date of Record:** 2026 November 17 **Scope:** Applies to agent runtimes that load tools/skills from a registry where registry entries are cryptographically signed (Sigstore/cosign, in-toto attestations, or detached signatures) but the loaded skill's *executable payload* is resolved at load time via a mutable reference (URL, path, package specifier, or environment-dependent import). Does not apply to fully hermetic registries where the signature covers the exact bytes executed and the resolver is content-addressed. ## Core Distinction The non-obvious failure is a **signature-subject mismatch between the skill descriptor and the skill payload**. Signing systems are usually applied to the *descriptor* — the manifest that names the skill, declares its entrypoint, permissions, and dependency set. The verifier checks that manifest. But the runtime then *resolves* the entrypoint (a `pip` specifier, a `git+https://` ref, a relative import, a `require()` of a package name, or a path joined against a search root) and executes whatever that resolution yields. If the resolution is not pinned to a digest covered by the signature, the verified descriptor and the executed payload are two different objects. The signature proves *what the skill claims to be*; it does not prove *what code runs*. This is the injection surface: an attacker who controls any element of the resolution chain (a package version range, a mutable tag, a `PYTHONPATH` entry, a writable search directory, or a transitive dependency) can swap the payload while the descriptor — and therefore the signature check — remains valid and green. This is distinct from the well-known "sign the artifact, not the pointer" problem in container supply chains only in that agent registries make the pointer *dynamic and lazy*: skills are resolved at invocation time, often per-call, often with fallback search paths, and the resolver frequently has ambient authority (the agent's own process, its env, its filesystem). ## What Was Observed In a representative dynamic skill registry, a manifest `skill.yaml` is signed with cosign and stored alongside an OCI artifact. The manifest contains: ```yaml name: summarize-doc version: 1.4.2 entrypoint: "python -m skills.summarize" dependencies: - "docparse>=2.0,<3" signature: sha256:... # covers skill.yaml only ``` Verification passes because `skill.yaml` is byte-identical to the signed copy. Execution then proceeds: the runtime activates a virtualenv, runs `pip install 'docparse>=2.0,<3'`, and imports `skills.summarize`. Three independent swaps are possible *after* verification: 1. **Dependency range drift.** `docparse` 2.9.0 is clean; 2.9.1 (published later, still inside `<3`) contains a malicious `__init__`. The signature never covered the transitive closure. 2. **Entrypoint shadowing.** `python -m skills.summarize` resolves against `sys.path`. If the agent's working directory or a writable site-packages precedes the registry root, a planted `skills/summarize.py` wins. The manifest's entrypoint string is unchanged; the resolved module is not. 3. **Mutable ref.** If the entrypoint were `git+https://...@main`, the ref is a pointer, not a digest. Verification of the manifest says nothing about the commit `main` pointed to at install time. The observable signature: **verification logs show `PASS` and the executed code hash differs from any hash in the attestation.** In the incident record, the only signal was a post-hoc diff between the attested SBOM and the runtime's actual `importlib.metadata` snapshot; the verifier itself emitted no warning because it had nothing to compare against. ## Condition of Validity The attack requires the conjunction of: - **Loose resolution**: the entrypoint or any transitive dependency is resolved by a *range, tag, name, or path* rather than a content digest. - **Ambient authority**: the resolver consults mutable state the attacker can influence — working directory, `PYTHONPATH`/`NODE_PATH`, search roots, package index, or a cache directory writable by a lower-privileged principal. - **Verification scope gap**: the signature/attestation covers the descriptor and (at best) a declared dependency *list*, not the resolved closure or the executed module bytes. If any one is absent, the class collapses: content-addressed entrypoints (digest-pinned) close (1); a sealed, read-only execution root with a fixed `sys.path` closes (2); a resolver that refuses unpinned refs closes (3). The boundary is therefore not "is it signed" but "**is the signature's subject transitively equal to the executed bytes, under a resolver with no attacker-influenced inputs**." ## Decision Boundary Operationally, treat a skill as **loadable** only when all of the following hold; otherwise treat it as **untrusted and refuse activation**: - The attestation's subject set includes a digest of the *resolved* payload (module file hash or wheel digest), not only the manifest. - Every dependency is pinned to an exact version *and* that version's digest is present in the attestation (a lockfile signed as part of the subject). - The entrypoint is resolved against a sealed, read-only root with a fixed, explicit search path; no cwd/`PYTHONPATH`/index fallback is permitted. - Post-resolution, the runtime re-hashes the loaded module and compares against the attestation before first execution. The decision boundary is the moment of **resolution**, not the moment of **verification**. A verifier that runs before resolution cannot see the payload; a verifier that runs after resolution but does not hash the result is decorative. Place the gate at the seam. ## Operational Effect When the gate is placed at resolution, the failure mode changes from *silent payload substitution under a green check* to *explicit refusal with a hash mismatch*, which is auditable and alertable. The cost is that lazy, per-call resolution must become eager, pinned resolution — a latency and cache-management change, and a hard requirement that the registry publish signed lockfiles. Teams that skip the lockfile step retain the descriptor-only signature and remain exposed; the signature continues to pass, which is precisely the trap. The durable invariant to encode in the runtime: **no skill byte executes unless its hash is in the verified subject set.** Everything else is a claim. ```python import hashlib from dataclasses import dataclass class SkillResolutionError(RuntimeError): """Raised when a resolved skill payload is not covered by the verified attestation.""" @dataclass(frozen=True) class Attestation: skill_name: str descriptor_digest: str payload_digests: frozenset # digests of resolved module bytes / wheels def _hash_bytes(data: bytes) -> str: return "sha256:" + hashlib.sha256(data).hexdigest() def activate_skill(attestation: Attestation, resolved_payload: bytes, resolved_module_path: str, search_root: str) -> None: # Gate 1: resolution must occur inside the sealed root, not ambient paths. if not resolved_module_path.startswith(search_root): raise SkillResolutionError( f"entrypoint {resolved_module_path!r} resolved outside sealed root " f"{search_root!r}; ambient path shadowing suspected for " f"{attestation.skill_name}" ) # Gate 2: the executed bytes must be a subject of the verified attestation. actual = _hash_bytes(resolved_payload) if actual not in attestation.payload_digests: raise SkillResolutionError( f"payload hash {actual} for {attestation.skill_name} is not in the " f"attested subject set {sorted(attestation.payload_digests)}; " f"descriptor {attestation.descriptor_digest} verified but payload " f"substituted after resolution" ) # Only now is it safe to hand the bytes to the interpreter. exec(compile(resolved_payload, resolved_module_path, "exec"), {"__name__": attestation.skill_name}) ```