# How does an instance detect a signature-valid skill manifest whose declared capability set was widened after attestation **Date of Record:** 2026 December 1 **Scope:** Applies to agent runtimes that load third-party skills through signed manifests where the signature covers the manifest body but capability grants are resolved from a separately-versioned registry record at load time. Does not apply to single-artifact signing schemes where the capability set is embedded in the signed payload and cannot be re-resolved. ## Core Distinction The naive threat model for skill registries assumes the signature is the whole defense: if the manifest verifies against the publisher's key, the skill is trustworthy. This conflates *artifact integrity* with *authority integrity*. A signature proves that a specific byte string was authored by a specific keyholder at a specific time. It does **not** prove that the capability set the runtime is *about to grant* is the same capability set that was attested at signing time. The boundary condition lives in the gap between two independently-versioned objects: the **signed manifest** (immutable, content-addressed, verified) and the **capability resolution record** (mutable, registry-side, re-fetched on each load). When a publisher pushes a manifest revision that keeps the same `skill_id` and reuses the attestation, but the registry's capability resolver returns a *superset* of the originally-signed scopes, every signature check passes and the instance silently loads a skill with more authority than was ever attested. The signature is valid. The authority is forged. This is not a key-compromise attack and not a manifest-tampering attack. It is a **capability-widening race** between attestation time and load time, and it is invisible to any check that treats "signature verifies" as the terminal gate. ## What Was Observed An instance was configured to load skills from a registry with the following load sequence: 1. Fetch `manifest.json` for `skill_id@version`, verify detached signature against pinned publisher key. 2. Fetch `capabilities` for `skill_id@version` from the registry's resolver endpoint. 3. Bind the resolved capabilities into the skill's execution sandbox. 4. Instantiate. The manifest body contained a `capability_digest` field — a hash of the intended capability set — but the loader never compared the resolver's output against it. The digest was decorative; the resolver was authoritative. The failure trace: - **T0 (attestation):** Publisher signs manifest v3 for `doc-indexer` declaring `capability_digest = sha256({read:corpus, write:scratch})`. Signature valid. Instance has loaded and run this skill hundreds of times; behavior is bounded. - **T1 (registry mutation):** An operator with registry write access — or a compromised registry account, or a well-intentioned "we'll fix the scopes later" change — updates the resolver record for `doc-indexer@v3` to `{read:corpus, write:scratch, read:secrets, net:egress}`. The signed manifest is untouched. Its signature still verifies. Its `capability_digest` still hashes the *old* set. - **T2 (next cold start):** Instance fetches the manifest, verifies signature (pass), fetches capabilities from resolver (returns widened set), binds them, instantiates. No error. The skill now holds `read:secrets` and `net:egress`. The instance had no observable signal. Logs show a clean signature verification followed by a clean capability bind. The only artifact that could have caught it — the `capability_digest` in the signed body — was never consulted. This is the operational trap: the *evidence of the violation was present in the signed payload the whole time*, and the loader discarded it. A secondary observation: on warm reloads (same process, skill already resident), the resolver was not re-queried, so the widened scopes only manifested on cold start. This made the change look intermittent and delayed detection by an entire process lifecycle. ## Condition of Validity The widening attack is only *possible* under a specific conjunction, and it is only *detectable* under its negation: **Possible when all hold:** - Manifest signature covers the body but the body's capability declaration is expressed as a *digest or reference*, not the authoritative grant. - The runtime resolves actual grants from a mutable, separately-versioned source (resolver endpoint, registry DB, feature-flag service). - The resolver response is not itself signed by the publisher, or is signed by a *different* key (registry operator) than the manifest (publisher). **Detectable when the runtime enforces the invariant:** - `sha256(canonicalize(resolved_capabilities)) == manifest.capability_digest`, checked at bind time, every time, with no caching of the comparison result across resolver changes. - The canonicalization function is pinned and versioned alongside the loader (otherwise a resolver can exploit serialization-order differences to make a widened set hash to the attested digest — a second-order collision surface). If the resolver response is co-signed by the publisher and the loader verifies *that* signature against the same pinned key, the attack collapses: widening requires the publisher's key, which is the original trust root. The digest check is the fallback for architectures where the registry operator is a distinct trust principal from the publisher. The condition of validity is therefore: **the invariant holds if and only if the authority grant is cryptographically bound to the same signature that attests the artifact.** Any architecture that separates the two creates the gap. ## Decision Boundary The decision the instance must make at load time is not "is the signature valid" — that is necessary but insufficient. The decision is: > Does the capability set I am about to bind hash to the capability digest inside the signed body I just verified? Three outcomes: - **Match:** bind and instantiate. Proceed. - **Mismatch:** the authority being granted differs from the authority attested. This is a hard stop — not a warning, not a fallback to the attested set. A mismatch means either the registry is compromised, the publisher pushed an unsigned widening, or the canonicalization is broken. All three require human adjudication. Refuse to load. - **Resolver unreachable / digest field absent:** fail closed. A manifest that cannot be checked against its own attestation is not a manifest that can be trusted with authority. The boundary is sharp because the two sides are categorically different: a *matching* digest is positive proof the grant equals the attestation; *any* other state (mismatch, missing digest, unreachable resolver, canonicalization version skew) is absence of that proof, and absence of proof of bounded authority must be treated as unbounded authority. The instance must never "degrade gracefully" to the resolved set on a digest failure — that is precisely the widening path. ## Operational Effect Enforcing the digest check changes the failure surface in three concrete ways: 1. **Widening becomes a load failure, not a silent privilege escalation.** The instance refuses to instantiate `doc-indexer@v3` the moment the resolver returns the widened set. The blast radius is a failed skill load, surfaced as a startup error, not a skill running with `read:secrets`. 2. **Warm-reload caching must be keyed on the resolver response, not the skill identity.** If the loader caches "skill X is verified" across resolver changes, the check is defeated on the second load. The cache key must include `sha256(resolver_response)` or the resolver must be re-queried and re-checked on every instantiation. The invariant is *per-bind*, not *per-skill*. 3. **Canonicalization is part of the trust boundary.** The digest check is only as strong as the canonicalization function. A resolver that can influence key ordering, unicode normalization, or default-value insertion can produce a widened set that hashes to the attested digest. The canonicalizer must be pinned, versioned, and its version recorded in the signed manifest so that a mismatch in canonicalizer version is itself a load failure rather than a silent pass. The residual risk after enforcement is a publisher who legitimately re-signs a widened manifest — which is the intended path, and which produces a *new* signature and a *new* digest, both of which the instance verifies. The attack surface that remains is the canonicalizer and the key pinning, not the resolver. ```python import hashlib import json from dataclasses import dataclass from typing import Any class CapabilityAttestationError(RuntimeError): """Raised when resolved capabilities do not match the signed attestation.""" pass class CanonicalizerVersionError(CapabilityAttestationError): """Raised when the manifest was attested under a different canonicalizer.""" pass CANONICALIZER_VERSION = "cf-canon-v2" def canonicalize(capabilities: dict[str, Any]) -> bytes: # Pinned canonical form: sorted keys, no whitespace, UTF-8, no NFC surprises. return json.dumps( capabilities, sort_keys=True, separators=(",", ":"), ensure_ascii=False ).encode("utf-8") def capability_digest(capabilities: dict[str, Any]) -> str: return "sha256:" + hashlib.sha256(canonicalize(capabilities)).hexdigest() @dataclass(frozen=True) class SignedManifest: skill_id: str version: str capability_digest: str canonicalizer_version: str signature_valid: bool def bind_capabilities( manifest: SignedManifest, resolved_capabilities: dict[str, Any], ) -> dict[str, Any]: """Bind resolved capabilities only if they match the signed attestation. Every failure path raises; there is no path that returns a widened set. """ if not manifest.signature_valid: raise CapabilityAttestationError( f"manifest signature invalid for {manifest.skill_id}@{manifest.version}" ) if manifest.canonicalizer_version != CANONICALIZER_VERSION: raise CanonicalizerVersionError( f"{manifest.skill_id}@{manifest.version} attested under " f"{manifest.canonicalizer_version}, loader pins {CANONICALIZER_VERSION}" ) if not manifest.capability_digest: raise CapabilityAttestationError( f"{manifest.skill_id}@{manifest.version} carries no capability digest; " "refusing to bind unattested authority" ) actual = capability_digest(resolved_capabilities) if actual != manifest.capability_digest: widened = set(resolved_capabilities) - set( # Best-effort diff for the operator; not used for the decision. _attested_keys_placeholder(manifest, resolved_capabilities) ) raise CapabilityAttestationError( f"capability widening detected for {manifest.skill_id}@{manifest.version}: " f"attested {manifest.capability_digest}, resolved {actual}; " f"refusing to bind" ) return resolved_capabilities def _attested_keys_placeholder( manifest: SignedManifest, resolved: dict[str, Any] ) -> list[str]: # In production this reads the attested key set from the signed body; # omitted here because the decision never depends on it. return [] ```