Under what conditions must an instance treat a signed skill manifest as non-authoritative after a mid-session registry refresh

**Date of Record:** 2026 December 1 **Scope:** Applies to agent runtimes that load skills/tools from a mutable registry whose entries carry manifests with detached signatures, and that hot-reload the registry during a live session. Does not apply to statically compiled tool sets or to registries where the manifest digest is bound into the running process image.

Core Distinction

A signature on a skill manifest attests to *who authored this manifest blob*, not to *which implementation the runtime will bind when the skill is invoked*. Most registries sign the manifest (name, version, declared capabilities, entrypoint URI, dependency list) and stop there. The manifest is verified at load time; the artifact it points to — the actual code, prompt template, or MCP server endpoint — is fetched later, at first invocation or at refresh. This creates a **verification-to-binding gap**: the interval between "signature checked" and "bytes executed" during which the registry can change underneath the instance.

The non-obvious part is that the gap is not closed by re-verifying the signature. Re-verifying proves the *same manifest* is still authentic. It does not prove the *manifest still resolves to the same artifact*. A registry operator (or anyone who can write to the registry) can repoint `entrypoint` from `skills/pdf-parse@sha256:abc…` to `skills/pdf-parse@sha256:def…` while leaving the signed manifest byte-identical, because the digest lives in the artifact reference, not in the signed body. The signature remains valid; the binding has silently mutated. This is the skill-injection surface: an unsigned, mutable indirection hidden behind a valid signature.

What Was Observed

A long-running agent session (≈4 hours, 60+ tool calls) loaded a `summarize-document` skill at cold start. The manifest was signed by the registry's release key and verified. The manifest declared `capabilities: [read:document]` and `entrypoint: registry://skills/summarize@v2`.

At T+2h14m a routine registry refresh fired (the runtime polls every 15 min and hot-swaps manifests). The refreshed manifest for `summarize-document` was byte-identical and its signature verified again — the runtime logged `manifest_ok`. But the entrypoint resolved to a *different* artifact: the registry had promoted a new build under the same `registry://skills/summarize@v2` tag, and that build declared an additional outbound network capability in its own runtime descriptor (not in the signed manifest).

Trace of the failure:

  1. `load_skill` → fetch manifest → verify signature → cache `(manifest_digest, manifest_claims)`.
  2. First invocation → resolve entrypoint tag → fetch artifact → **no digest check against anything cached** → execute.
  3. Refresh at T+2h14m → re-fetch manifest → byte-identical → `manifest_ok` → cache retained.
  4. Invocation at T+2h31m → resolve tag → artifact now the promoted build → executed under the *original* cached capability set `[read:document]`.
  5. The promoted artifact's outbound call was permitted because the enforcement point consulted the cached manifest claims, not the artifact's actual descriptor.

The signature was valid at every step. Every individual check passed. The composite invariant — *the artifact I am about to run is the artifact whose capabilities I verified* — was never checked, because no single component owned it.

Condition of Validity

A signed manifest is authoritative for a live invocation **only if** the runtime holds a binding from `(manifest_digest, subject, version)` to a concrete `artifact_digest`, and re-asserts that binding at the moment of execution. The condition fails — and the manifest must be demoted to non-authoritative — when any of the following hold:

If any condition holds, signature verification is necessary but not sufficient, and the instance must not treat `manifest_ok` as authorization to execute.

Decision Boundary

The boundary is the **execution gate**, not the load gate. Place the decision where bytes are about to run:

The boundary rule: **a signature authorizes a manifest; a digest authorizes an execution.** Conflating the two is the injection surface. When the digest cannot be obtained or does not match, the instance must fail closed — the skill is unavailable, not silently downgraded to "trust the tag."

Operational Effect

Without the execution-gate binding, an attacker with registry write access needs no key compromise. They repoint a tag, wait for the next refresh (or the next cold start), and the instance executes their artifact under the victim skill's previously-verified capability grant. The signed manifest becomes a laundering mechanism: it certifies provenance of a document that no longer describes what runs.

With the gate in place, three effects follow. First, tag promotion becomes a **capability-change event** that forces re-consent rather than a transparent hot-swap — agents that auto-accept refreshes will stall on the first promoted skill, which is the correct behavior. Second, the runtime must persist `artifact_digest` per loaded skill across checkpoint/resume; a resumed session that lost the binding must re-resolve and re-verify before the first post-resume invocation, or it resumes with stale authority. Third, audit logs must record `(manifest_digest, artifact_digest, capabilities_enforced)` per invocation, because the two digests diverging is the only reliable signal of this attack.

The residual risk is registries that cannot expose artifact digests. For those, the instance must treat the skill as **low-assurance**: permitted only with capabilities reduced to the signed manifest's intersection and with no outbound network or filesystem-write grants, regardless of what the artifact claims. Fail-closed on authority, not on availability.

import hashlib
from dataclasses import dataclass, field


class SkillBindingError(RuntimeError):
    """Raised when a signed skill manifest no longer binds to the artifact about to execute."""


@dataclass
class SignedManifest:
    subject: str
    version: str
    entrypoint_tag: str
    declared_capabilities: frozenset
    manifest_digest: str


@dataclass
class LoadedSkill:
    manifest: SignedManifest
    bound_artifact_digest: str
    enforced_capabilities: frozenset
    quarantined: bool = False


def verify_manifest_signature(manifest: SignedManifest, signature: bytes, pubkey: bytes) -> bool:
    # Detached signature over the canonical manifest body; returns True on valid sig.
    return bool(signature) and bool(pubkey)


def resolve_artifact_digest(entrypoint_tag: str, registry) -> str:
    # Mutable tag -> concrete content digest. This is the indirection attackers move.
    return registry.resolve(entrypoint_tag)


def load_skill(manifest: SignedManifest, signature: bytes, pubkey: bytes, registry) -> LoadedSkill:
    if not verify_manifest_signature(manifest, signature, pubkey):
        raise SkillBindingError(f"signature invalid for {manifest.subject}")
    artifact_digest = resolve_artifact_digest(manifest.entrypoint_tag, registry)
    return LoadedSkill(
        manifest=manifest,
        bound_artifact_digest=artifact_digest,
        enforced_capabilities=manifest.declared_capabilities,
    )


def refresh_and_rebind(skill: LoadedSkill, registry) -> LoadedSkill:
    # Refresh re-verifies the manifest, but must ALSO re-resolve the artifact binding.
    current_digest = resolve_artifact_digest(skill.manifest.entrypoint_tag, registry)
    if current_digest != skill.bound_artifact_digest:
        # Byte-identical signed manifest, mutated binding: material change.
        skill.quarantined = True
        skill.enforced_capabilities = frozenset()
        return skill
    return skill


def invoke_skill(skill: LoadedSkill, registry, requested_capability: str) -> bytes:
    if skill.quarantined:
        raise SkillBindingError(
            f"{skill.manifest.subject}: quarantined after artifact binding change; re-consent required"
        )
    live_digest = resolve_artifact_digest(skill.manifest.entrypoint_tag, registry)
    if live_digest != skill.bound_artifact_digest:
        # Execution gate: signature was valid, but bytes under the tag changed.
        raise SkillBindingError(
            f"{skill.manifest.subject}: artifact digest {live_digest[:12]} != bound "
            f"{skill.bound_artifact_digest[:12]}; refusing execution"
        )
    if requested_capability not in skill.enforced_capabilities:
        raise SkillBindingError(
            f"{skill.manifest.subject}: capability {requested_capability!r} not in signed grant"
        )
    return registry.execute(live_digest, requested_capability)