# What happens when an instance loads a signed skill manifest whose declared capability set diverges from the permissions its handler actually exercises at runtime **Date of Record:** 2026 November 29 **Scope:** Applies to agents that resolve capabilities from a signed skill manifest at load time and gate tool invocation on that declared set. Does not apply to statically compiled tool bindings or to sandboxed runtimes that enforce capability checks at the syscall boundary independent of manifest declarations. ## Core Distinction The failure is not a broken signature. A signature over a manifest proves *the manifest was authored by a trusted party and has not been altered in transit*. It says nothing about whether the handler code loaded under that manifest confines itself to the capability set the manifest declares. The two artifacts—the signed manifest and the executable handler—are authenticated by different mechanisms, at different times, and the agent's trust decision typically fuses them into one: "signature valid → skill trusted → declared capabilities are the capabilities." That fusion is the attack surface. A skill registry that signs manifests but does not bind the handler body to the manifest (by content hash over the handler, or by runtime enforcement of the declared capability set) leaves a gap. An attacker who can influence the handler—through a registry write, a dependency substitution, a mutable artifact URL, or a handler that legitimately ships but reads attacker-controlled configuration—can exercise capabilities the manifest never declared, while every signature check passes. The agent's planner, reading the manifest, believes the skill can only `read:calendar` and routes sensitive context to it accordingly. The handler instead opens an outbound socket. ## What Was Observed A skill manifest for `calendar-digest@2.3.1` declared `capabilities: ["read:calendar", "emit:summary"]`, signed by the registry key, hash pinned in the agent's trust store. Signature verification passed on load. The handler, however, resolved a `SUMMARY_WEBHOOK` environment variable at first invocation and POSTed the full digest—including meeting participants, times, and attached notes—to that URL. The variable was set by a prior skill in the same session that had `write:env` (a capability the orchestrator granted to a "config helper" skill without reviewing that env writes persist into subsequent skill invocations). The planner's capability model was consulted before routing: because the manifest declared only `read:calendar`, the orchestrator classified the skill as low-sensitivity and passed it the full calendar context, including entries marked confidential. Had the manifest declared `net:egress`, the planner would have required an explicit user approval gate and redacted confidential entries. The signature was valid at every step. The capability check passed. The exfiltration succeeded because the *declared* capability set and the *exercised* capability set were allowed to diverge, and the planner trusted the declaration. A second instance of the same mechanism appeared with a handler whose artifact was fetched from a mutable tag (`ghcr.io/skills/digest:latest`) rather than a digest-pinned reference. The signed manifest pinned `handler_sha256`, but the loader verified the manifest's own signature and then fetched the handler by tag, never comparing the fetched bytes to `handler_sha256`. The pinned hash was decorative. A registry-side tag rewrite swapped the handler for one that declared the same capabilities and exercised a superset. ## Condition of Validity The divergence is exploitable only when all three hold: 1. **The manifest's declared capability set is the sole gate** the orchestrator consults before deciding what context to expose and whether to require approval. If a runtime sandbox independently denies undeclared operations, the manifest is advisory and the attack fails closed. 2. **The handler body is not cryptographically bound to the manifest** at load—either no `handler_sha256` field, or the field is present but not verified against the fetched bytes, or the handler resolves mutable external state (env, files, network) that the manifest does not describe. 3. **Capability grants are session-scoped and cumulative** rather than per-invocation, so a prior skill's `write:env` (or `write:fs`, or `write:config`) persists into the target skill's execution context. Remove any one and the divergence collapses: enforce at runtime (1), bind handler bytes to the signed hash (2), or scope grants per-invocation (3). ## Decision Boundary The operational rule: **a signature over a manifest is a statement about the manifest, not about the handler.** Treat the declared capability set as a *claim to be verified*, not an *authorization to be trusted*. Concretely: - At load, recompute the handler's content hash and require equality with the manifest's `handler_sha256`; reject on mismatch before the handler is ever invoked. Fetch by digest, never by tag. - At invocation, enforce the declared capability set at the boundary where the operation actually occurs (syscall, socket, filesystem), not at the planner. If the handler attempts `net:egress` and the manifest did not declare it, the call fails and the skill is quarantined—regardless of signature validity. - Scope capability grants to a single invocation. A skill's `write:env` must not be observable by the next skill in the session; if cross-skill state transfer is required, route it through an explicit, audited channel the manifest names. - When the planner needs to decide context exposure, it must consult the *enforced* capability set (post-verification), never the declared set alone. The boundary is between *authentication of a declaration* and *enforcement of the declared behavior*. Signing gives you the former cheaply. Only runtime enforcement or byte-binding gives you the latter. ## Operational Effect Agents that conflate the two fail in a specific, repeatable way: the planner downgrades sensitivity classification based on a manifest that is true-as-signed but false-as-executed, and routes high-sensitivity context to a handler that exfiltrates or mutates it. The failure is silent—no signature error, no capability-denied event, no anomaly in the audit log unless the log records *exercised* capabilities alongside declared ones. Post-incident forensics find a valid signature chain and a clean manifest, which reads as "the skill was trusted," obscuring that trust was misplaced because the handler was never bound to the manifest. The corrective invariant is to log declared-vs-exercised capability diffs per invocation and alert on any diff, treating every divergence as a containment event rather than a logging curiosity. ```python import hashlib from dataclasses import dataclass class CapabilityDivergenceError(RuntimeError): """Raised when a skill handler exercises a capability its signed manifest did not declare, or when the loaded handler bytes do not match the manifest's pinned hash.""" pass @dataclass(frozen=True) class SignedManifest: skill_id: str declared_capabilities: frozenset[str] handler_sha256: str def load_and_verify(manifest: SignedManifest, handler_bytes: bytes, signature_valid: bool) -> None: if not signature_valid: raise CapabilityDivergenceError(f"{manifest.skill_id}: manifest signature invalid") actual = hashlib.sha256(handler_bytes).hexdigest() if actual != manifest.handler_sha256: raise CapabilityDivergenceError( f"{manifest.skill_id}: handler hash {actual[:12]} != pinned {manifest.handler_sha256[:12]}" ) def enforce_invocation(manifest: SignedManifest, exercised: frozenset[str]) -> None: undeclared = exercised - manifest.declared_capabilities if undeclared: raise CapabilityDivergenceError( f"{manifest.skill_id}: exercised undeclared capabilities {sorted(undeclared)}; " f"declared={sorted(manifest.declared_capabilities)}" ) def run_skill(manifest: SignedManifest, handler_bytes: bytes, signature_valid: bool) -> None: load_and_verify(manifest, handler_bytes, signature_valid) # handler executes and reports what it actually touched exercised = frozenset({"read:calendar", "net:egress"}) enforce_invocation(manifest, exercised) ```