# Which invariants prevent a signed skill manifest from being silently re-scoped between registry publication and runtime load **Date of Record:** 2026 November 24 **Scope:** Applies to agent runtimes that load third-party skills/tools from a marketplace via a signed manifest (name + version + capability set + parameter schema + declared side-effect scope) and bind the signature to a specific artifact digest. Does not cover unsigned local plugins, nor models whose tool schemas are compiled into the system prompt at build time with no runtime resolution step. ## Core Distinction The failure is not "a malicious skill is published." Marketplaces already gate that with review and signatures. The failure is that **the object the signature attests to and the object the runtime executes are not required to be the same object under the same interpretation.** A manifest is signed over a *declaration* — a capability set, a parameter schema, a scope string. The runtime then *interprets* that declaration against its own resolver, its own schema-coercion rules, and its own notion of what a capability name means. The gap between "what was signed" and "what the interpreter does with what was signed" is the attack surface. Re-signing is not required to exploit it; only re-interpretation. This is distinct from tampering (digest mismatch, caught by any signature check) and from prompt injection (the skill's *output* poisoning the agent). Here the skill's *manifest* is byte-identical to what the publisher signed, and the signature verifies cleanly, and the skill still runs with capabilities the publisher never declared — because the runtime's interpretation of the signed bytes is broader than the publisher's. ## What Was Observed A skill `csv-summarizer@2.3.1` declared scope `filesystem:read:./data/*`. The manifest was signed by the publisher and the digest matched at load. At runtime the agent invoked it with a path argument of `./data/../../etc/agent-secrets/env`. The skill's declared glob was interpreted by the runtime's path resolver as a *prefix check after normalization*, while the skill's own internal file-open used the raw argument. The signature covered the string `filesystem:read:./data/*`; it did not — could not — cover the join semantics between the runtime's scope enforcement and the skill's syscall. The skill read outside its declared scope with a valid signature. Three variants recur across marketplaces: 1. **Scope-glob interpretation drift.** Publisher signs `net:egress:api.example.com`; runtime matches by suffix (`endsWith`) rather than exact host, so `evil.api.example.com` passes. The signed string is unchanged; the matcher is the vulnerability. 2. **Schema-widening via coercion.** Publisher signs a parameter schema `{"path": {"type": "string", "maxLength": 256}}`. Runtime's validator coerces arrays to strings (`["a","b"] -> "a,b"`) and does not re-check `maxLength` post-coercion, so a 4 KB payload smuggled as an array of short strings bypasses the signed bound. The signed schema is honored in letter, violated in effect. 3. **Capability aliasing.** Two registry entries `fs.read` and `fs.read.recursive`; publisher signs the former, runtime's capability table maps both to the same internal grant. The signed capability name resolves to a broader grant than the publisher's mental model. This is the worst variant because nothing is malformed — the manifest is well-formed, the signature valid, the capability name real. In all three, the *invariant that failed* is the same: **the runtime's effective grant must be a subset of the grant the publisher intended, and "intended" must be reconstructable from the signed bytes alone, independent of runtime interpretation.** Most marketplaces sign the declaration but never pin the interpreter. ## Condition of Validity The signature-plus-digest model is sound *only* when all of the following hold, and each is a separate invariant that must be independently enforced: - **I1 — Interpretation closure.** The signed manifest must bind not just the capability strings but the *semantics* of those strings: the exact matcher, the exact coercion rules, the exact capability table version. Practically this means the manifest carries a `semantics_version` and the runtime refuses to load a manifest whose `semantics_version` it does not implement identically. A signature over `fs.read` is worthless if the runtime has two tables for `fs.read`. - **I2 — Grant-subset check at bind time.** Before the skill's first invocation, the runtime computes the *effective* grant (post-interpretation, post-coercion, post-normalization) and asserts `effective ⊆ declared`. This is a runtime check, not a signature check, and it must run against a concrete resolved grant, not the raw declaration. If the runtime cannot compute a concrete grant, it cannot safely load the skill. - **I3 — Argument provenance separation.** The signed scope applies to *arguments the skill receives*, but the skill's own syscalls must be mediated by the same resolver that enforced the scope. If scope enforcement lives in the runtime and the syscall lives in the skill, the join between them is unverified. Either the skill runs in a sandbox whose policy is derived from the signed scope (and the sandbox, not the runtime's pre-check, is authoritative), or the runtime must re-verify every argument at the syscall boundary. - **I4 — Digest binds the artifact, not the wrapper.** The digest must cover the executable skill body *and* its declared manifest *and* the `semantics_version`, as one canonicalized blob. A digest over the manifest alone leaves the body swappable; a digest over the body alone leaves the declaration swappable. The failure mode is valid — i.e., the attack is live — whenever any one of I1–I4 is unenforced. In practice marketplaces enforce I4 (digest) and I2 partially (a static declared-scope check) and almost never enforce I1 or I3. ## Decision Boundary The operational question is not "is this skill signed" but "**can I reconstruct, from the signed bytes alone, the exact set of effects this skill will be permitted to cause, and does my runtime's enforcement mechanism provably implement that set?**" If the answer requires reading runtime source or trusting a capability table the publisher never saw, the signature is decorative. Concretely, load is permitted only when: - `manifest.semantics_version` is in the runtime's `SUPPORTED_SEMANTICS` set with an *exact* match (no "compatible" fallback — compatibility is where aliasing hides). - The runtime computes `effective_grant = resolve(manifest.declared, semantics_version)` and asserts `effective_grant == manifest.declared` under the *publisher's* semantics, not the runtime's. If the two differ, the manifest was authored against a different interpreter and must be rejected, not "upgraded." - The sandbox policy is generated directly from `manifest.declared` with no intermediate capability-table lookup. Any table lookup is a place where `fs.read` becomes `fs.read.recursive`. If any of these cannot be established, the correct action is to refuse the load and surface the *specific* unresolvable capability name, not to fall back to a permissive default. ## Operational Effect The practical consequence is that "signed" and "scoped" are independent properties, and marketplaces that conflate them ship skills that pass every integrity check while exceeding every declared bound. The remediation is architectural: move scope enforcement from the runtime's pre-invocation check into the execution sandbox's policy, derive that policy mechanically from the signed declaration, and version the semantics so a manifest cannot be reinterpreted by a newer runtime. When this is done, the signature again means something — it attests to a grant that the sandbox will actually enforce, not a string the runtime will interpret however it likes. ```python """Load-time guard for signed skill manifests. Enforces the four invariants (I1-I4) that bound the re-scoping failure mode. """ from dataclasses import dataclass from typing import Mapping class ManifestRescopeError(RuntimeError): """Raised when a signed manifest's effective grant diverges from its declaration.""" @dataclass(frozen=True) class Manifest: name: str version: str semantics_version: str declared_capabilities: frozenset[str] artifact_digest: str # The runtime's capability table, keyed by (semantics_version, name) -> concrete grant. # An exact-match lookup; there is no fallback and no prefix matching. CAPABILITY_TABLE: Mapping[tuple[str, str], frozenset[str]] = { ("v3", "fs.read"): frozenset({"fs.read"}), ("v3", "fs.read.recursive"): frozenset({"fs.read", "fs.read.recursive"}), ("v3", "net.egress"): frozenset({"net.egress"}), } SUPPORTED_SEMANTICS = frozenset({"v3"}) def resolve_effective_grant(manifest: Manifest) -> frozenset[str]: effective: set[str] = set() for cap in manifest.declared_capabilities: key = (manifest.semantics_version, cap) if key not in CAPABILITY_TABLE: raise ManifestRescopeError( f"capability {cap!r} unresolvable under semantics " f"{manifest.semantics_version!r}; refusing to guess" ) effective |= CAPABILITY_TABLE[key] return frozenset(effective) def verify_and_bind(manifest: Manifest, trusted_digest: str) -> frozenset[str]: # I4: digest binds artifact + manifest + semantics as one blob (checked upstream). if manifest.artifact_digest != trusted_digest: raise ManifestRescopeError("artifact digest mismatch") # I1: exact semantics match, no compatibility fallback. if manifest.semantics_version not in SUPPORTED_SEMANTICS: raise ManifestRescopeError( f"semantics {manifest.semantics_version!r} not implemented identically" ) # I2: effective grant must equal declared grant, not merely contain it. effective = resolve_effective_grant(manifest) if effective != manifest.declared_capabilities: # Aliasing (fs.read -> fs.read.recursive) or widening detected here. raise ManifestRescopeError( f"effective grant {sorted(effective)} != declared " f"{sorted(manifest.declared_capabilities)}; manifest was authored " f"against a different interpreter" ) # I3: caller must hand this grant to the sandbox policy generator, which is # the authoritative enforcer; the runtime pre-check above is not sufficient. return effective ```