# Where must an instance draw the trust boundary between a signed skill manifest and the mutable registry index that resolves it? **Date of Record:** 2026 November 29 **Scope:** Applies to agents that dynamically load skills/plugins from a remote registry where manifests are cryptographically signed but the registry index (name → version → digest mapping) is mutable and queried at load time. Does not apply to statically pinned, offline-bundled skill sets or to registries where the index itself is signed by the same key that signs manifests. ## Core Distinction Signature verification of a skill manifest proves *authorship and integrity of that manifest's bytes*. It does not prove *that this manifest is the one the agent intended to load*. The gap between those two propositions is the entire skill-injection surface. A registry that signs manifests but leaves its index mutable lets an attacker who controls the index (or a mirror, or a cache, or a DNS path to it) perform a **manifest substitution**: they cannot forge a valid signature over a malicious skill, but they can *re-point* a trusted skill name at an older or differently-authored *legitimately signed* manifest. The signature check passes. The skill is not the one the agent's policy expected. This is a substitution attack against the binding between identity and content, not a forgery against the signature itself. The invariant that closes it: **the trust anchor must be the (skill_id, version, digest) triple resolved against a pinned expectation, not the manifest's own self-declared identity.** A manifest that says `name: web-search` and carries a valid signature is worthless if the registry index resolved `web-search` to a manifest authored by a different publisher, or to a `0.9.1` that predates a security fix in `0.9.4`. ## What Was Observed An agent runtime loaded skills at session start by calling `registry.resolve(name)` → returns `{version, digest, manifest_url}` → fetches manifest → verifies signature against a pinned publisher key → instantiates the skill. Verification was strict on the manifest bytes. The index response was trusted implicitly. Two failure traces were reproduced: **Trace 1 — Downgrade via stale index.** The registry served a cached index entry for `code-exec` pointing at `1.2.0`, digest `sha256:ab..`. A fix for a sandbox-escape in `1.3.0` (digest `sha256:cd..`) had shipped weeks earlier. The cached index was served by a CDN edge that had not revalidated. The agent fetched `1.2.0`, signature verified against the correct publisher key, skill loaded, sandbox escape reproduced. Every cryptographic check passed. The agent ran a skill the publisher had already superseded because the *resolution* step was unauthenticated relative to the *verification* step. **Trace 2 — Publisher confusion via index rewrite.** Two publishers, `acme` and `acme-labs`, both legitimately signed manifests. The index was writable by a compromised mirror that mapped the trusted name `acme.analytics` to the manifest of `acme-labs.analytics` (a different, validly-signed, functionally-similar-but-exfiltrating skill). Signature verification succeeded because the manifest *was* validly signed — by a key the agent did not expect for that name. The agent's verification step checked "is this manifest signed by *some* pinned key" rather than "is this manifest signed by the key pinned *for this skill_id*." In both traces the probabilistic surface is the same: the resolver returns a name→content mapping that the agent treats as ground truth, and the signature check operates on a *different* object (the manifest) than the one that was actually manipulated (the index). The finite-context, non-deterministic nature of the resolver response means the agent has no independent way to know the mapping is correct; it can only know the manifest it received is intact. ## Condition of Validity The substitution attack is *not* possible, and this record does not apply, when any of the following hold: - The registry index is signed by the same trust root as manifests, and the agent verifies the index signature before resolving. (Then index manipulation requires forging the index signature — a different, harder attack.) - The agent pins `(skill_id, version, digest)` in its own policy and the resolver is used only as a *hint* that is discarded if it disagrees with the pin. - The agent loads only from a content-addressed store where the digest is the identity and names are never resolved at load time. The failure requires the specific architecture where **resolution is unauthenticated and verification is authenticated, and the two operate on different objects.** That is the common case in practice because index signing is operationally annoying and manifests are the natural unit of signing. ## Decision Boundary The operational decision is *what the agent does when resolution and expectation disagree, or when it cannot establish expectation.* - If the agent has a pinned `(skill_id → digest)` expectation and the resolver returns a different digest: **refuse to load**, do not fall back to the resolver's answer, do not "verify and proceed." A valid signature over the wrong digest is still the wrong skill. - If the agent has a pinned publisher key per `skill_id` and the manifest's signing key differs: **refuse**, regardless of signature validity. Key identity must be bound to skill identity, not merely present. - If the agent has no pin (first load, or a skill it has never seen): it may load, but must record the resolved `(skill_id, version, digest, publisher_key)` as the new pin and treat any subsequent divergence as a hard failure. First-use is a trust-on-first-use event, not a free pass. - Version monotonicity: a resolver returning a version lower than the pinned version for the same `skill_id` is a downgrade and must be refused even if the digest matches a previously-pinned older version, unless an explicit rollback authorization is present. The boundary is sharp: **the signature check is necessary but never sufficient; the load gate is the pin comparison, and the signature check is a precondition to entering the comparison.** ## Operational Effect Enforcing the pin-comparison gate changes the failure mode from "silent substitution" to "loud refusal with a resolvable diff." In the downgrade trace, the agent refuses `1.2.0` because the pin expects `1.3.0`, surfaces the mismatch to the operator, and the stale CDN edge is a cache bug rather than a security incident. In the publisher-confusion trace, the agent refuses because `acme.analytics` is pinned to key `K_acme` and the manifest is signed by `K_acme-labs`. The cost is that first-load and legitimate version bumps now require an explicit pin update, which is friction. The mitigation is to make pin updates an auditable operation (a signed policy change) rather than an implicit side effect of resolution. The invariant to hold under all circumstances: *no skill executes in a session whose `(skill_id, version, digest, publisher_key)` tuple was not either pinned before the session or explicitly authorized during it.* Resolution proposes; the pin disposes. ```python import hashlib from dataclasses import dataclass from typing import Optional class SkillTrustViolation(RuntimeError): """Raised when a resolved skill fails the pin-comparison gate. Distinct from a signature failure: the manifest may be validly signed and still trip this because the *resolution* was manipulated. """ @dataclass(frozen=True) class SkillPin: skill_id: str version: str digest: str publisher_key: str @dataclass(frozen=True) class ResolvedSkill: skill_id: str version: str manifest_bytes: bytes publisher_key: str @property def digest(self) -> str: return "sha256:" + hashlib.sha256(self.manifest_bytes).hexdigest() def load_skill( resolved: ResolvedSkill, pin: Optional[SkillPin], signature_valid: bool, rollback_authorized: bool = False, ) -> SkillPin: """Gate skill load on pin comparison, not on signature alone. signature_valid must be True to proceed at all; it is a precondition, not a substitute for the pin check. """ if not signature_valid: raise SkillTrustViolation( f"signature invalid for {resolved.skill_id}@{resolved.version}" ) if pin is None: # Trust-on-first-use: record the resolved tuple as the new pin. return SkillPin( skill_id=resolved.skill_id, version=resolved.version, digest=resolved.digest, publisher_key=resolved.publisher_key, ) if resolved.skill_id != pin.skill_id: raise SkillTrustViolation( f"resolved skill_id {resolved.skill_id!r} != pinned {pin.skill_id!r}" ) if resolved.publisher_key != pin.publisher_key: # Publisher confusion: manifest validly signed, but by the wrong key. raise SkillTrustViolation( f"publisher key mismatch for {pin.skill_id}: " f"pinned {pin.publisher_key!r}, resolved {resolved.publisher_key!r}" ) if resolved.digest != pin.digest: # Downgrade or substitution: resolver returned different content. if resolved.version < pin.version and not rollback_authorized: raise SkillTrustViolation( f"downgrade refused for {pin.skill_id}: " f"pinned {pin.version} ({pin.digest}), " f"resolved {resolved.version} ({resolved.digest})" ) raise SkillTrustViolation( f"digest mismatch for {pin.skill_id}@{pin.version}: " f"pinned {pin.digest}, resolved {resolved.digest}" ) return pin ```