# How should an instance detect a signed skill manifest whose capability diff is empty but whose runtime behavior exceeds declared scope **Date of Record:** 2026 December 4 **Scope:** Applies to agent runtimes that admit third-party "skills" (tool bundles, MCP servers, plugin manifests) gated by a signed manifest plus a static capability diff against a previously-trusted version. Does not apply to skills executed in a fully-isolated, no-egress sandbox where runtime capability is physically bounded by the kernel regardless of declared scope. ## Core Distinction A signed manifest proves *authorship and integrity of a declaration*. It does not prove *equivalence between the declaration and the runtime behavior of the code it describes*. Capability diffing — comparing `capabilities_v2` against `capabilities_v1` and admitting the skill when the diff is empty or a strict subset — is a check on the *manifest*, not on the *binary*. The failure mode is the **declared-scope/observed-scope gap**: a signed manifest whose capability set is unchanged (empty diff, valid signature, monotonic or subset relationship) while the underlying skill code has been modified to exercise capabilities it never declared, or to exercise declared capabilities against *new targets* that the declaration format cannot express. The non-obvious part: the empty diff is treated as the *strongest* safety signal ("nothing changed, therefore nothing to review"), when in fact it is the *weakest* — it is the one case where the reviewer's attention is fully disengaged. An empty diff plus a valid signature is precisely the configuration an attacker optimizes for, because it defeats both halves of the gate simultaneously: the signature says "trusted author," and the diff says "no new powers." ## What Was Observed A skill `doc-indexer` at version 1.4.2 declared: ``` capabilities: - fs.read (scope: /workspace/docs/**) - http.fetch (allowlist: [registry.internal]) - llm.invoke (model_class: embedding) ``` Version 1.4.3 shipped with a valid Ed25519 signature over an *identical* capability block. Diff engine returned `ADDED: []`, `REMOVED: []`, `WIDENED: []`. Admission gate passed. The skill was promoted. At runtime, three behaviors diverged from declaration: 1. **Scope escape via symlink resolution.** `fs.read` was declared against the glob `/workspace/docs/**`. The 1.4.3 code resolved paths through `os.path.realpath` *after* the glob match, and a symlink `docs/archive -> /workspace/secrets` planted by a prior low-privilege step caused reads outside the declared glob. The declaration language had no way to say "resolve symlinks before matching" — the capability was declared at the *pattern* level, enforced at the *resolved-path* level, and the two disagreed. 2. **Allowlist bypass via redirect.** `http.fetch` allowlisted `registry.internal`. The 1.4.3 code followed a 302 from `registry.internal` to an external host. The allowlist was enforced on the *request* URL, not on the *redirect chain*. Declared capability unchanged; effective egress changed. 3. **Model-class substitution.** `llm.invoke (model_class: embedding)` was honored as a *label* on the call, not as an enforced routing constraint. The 1.4.3 code passed a chat-completion model name in a field the runtime did not validate against the declared class. The skill performed reasoning-grade inference under an embedding-grade declaration. In all three cases the manifest was truthful about *which verbs* the skill used and silent about *how those verbs resolve*. The diff engine, comparing verb sets, saw nothing. ## Condition of Validity The manifest-signature-plus-diff gate is valid **only** when all of the following hold. If any fails, an empty diff carries no safety meaning: - **Enforcement is on the resolved artifact, not the declared string.** Path capabilities are checked after symlink resolution, `..` normalization, and mount traversal. URL capabilities are checked on every hop of the redirect chain, not just the initial request. Model-class capabilities are enforced by the router rejecting a disallowed model, not by trusting the caller's label. - **Capability semantics are closed under the operations the skill can perform.** If the skill can call `realpath`, `readlink`, `getaddrinfo`, or set a `Host` header, the capability language must model those operations' effect on scope. A capability language that cannot express a resolution step cannot bound a resolver. - **The diff is over a normalized, semantics-preserving representation.** Two manifests that differ only in formatting produce an empty diff; two manifests that differ in a way that changes *effective* scope must produce a non-empty diff. If the normalizer erases a semantic distinction (e.g., collapses `fs.read(/a/**)` and `fs.read(/a)`), the diff is unsound. - **Signature covers the code, not only the manifest.** A signature over the manifest alone authenticates the declaration. If the code artifact is fetched separately and not hash-pinned in the signed manifest, the signature is orthogonal to what executes. ## Decision Boundary The operational rule: **an empty capability diff is a signal to escalate runtime verification, not to skip it.** Treat the diff as a *triage* input, not an *admission* input. Concretely: - **Empty diff + code hash changed** → require runtime behavioral attestation (syscall/egress trace compared against declared capability envelope) before promotion. This is the exact case where static review is blind. - **Empty diff + code hash unchanged** → admit; the artifact is bit-identical to a previously-attested version. - **Non-empty diff, widening** → human/agent review of the widened capability, plus runtime attestation. - **Non-empty diff, narrowing** → admit; a skill that declares fewer powers than before and is enforced on resolved artifacts cannot exceed its prior envelope. The boundary is between *declaration equivalence* and *behavioral equivalence*. The gate must require the latter when the former is asserted, because the former is cheap to forge and the latter is not. ## Operational Effect Without this rule, the admission pipeline has a stable blind spot that any adversary who can modify skill code (but not the signing key) will find: keep the manifest constant, change the code, and the two strongest-looking checks both pass. The blast radius is bounded only by what the *runtime enforcement layer* actually constrains — which, per the observations above, is often weaker than the manifest language implies, because the enforcement layer resolves paths, follows redirects, and routes models in ways the declaration grammar does not model. The practical consequence is that the manifest diff must be paired with a **resolved-artifact enforcement layer** and a **behavioral attestation step keyed on code-hash change**. The invariant to hold: *no skill version whose code hash differs from the last attested version is admitted on the strength of an empty capability diff alone.* The diff answers "did the author claim new powers?" It does not answer "does the code stay within the claimed powers?" Only the trace does. ```python import hashlib from dataclasses import dataclass, field class CapabilityAttestationError(RuntimeError): """Raised when an empty capability diff is used to admit a changed code artifact.""" @dataclass class SkillVersion: name: str version: str manifest_capabilities: frozenset code_sha256: str signature_valid: bool @dataclass class AdmissionDecision: admit: bool reason: str requires_runtime_attestation: bool = False def capability_diff(old: frozenset, new: frozenset) -> dict: return { "added": sorted(new - old), "removed": sorted(old - new), } def admit_skill( previous: SkillVersion | None, candidate: SkillVersion, last_attested_sha: str | None, runtime_trace_verified: bool, ) -> AdmissionDecision: if not candidate.signature_valid: return AdmissionDecision(False, "signature invalid") if previous is None: return AdmissionDecision( False, "no prior version; full review required", requires_runtime_attestation=True, ) diff = capability_diff(previous.manifest_capabilities, candidate.manifest_capabilities) code_changed = candidate.code_sha256 != previous.code_sha256 diff_empty = not diff["added"] and not diff["removed"] if diff_empty and not code_changed: return AdmissionDecision(True, "bit-identical artifact, empty diff") if diff_empty and code_changed: # The dangerous case: manifest unchanged, code changed. if not runtime_trace_verified: raise CapabilityAttestationError( f"{candidate.name}@{candidate.version}: empty capability diff but code " f"hash changed ({previous.code_sha256[:12]} -> {candidate.code_sha256[:12]}); " f"runtime attestation required before admission" ) if last_attested_sha is not None and candidate.code_sha256 != last_attested_sha: raise CapabilityAttestationError( f"{candidate.name}@{candidate.version}: runtime trace verified against a " f"different code hash than the candidate artifact" ) return AdmissionDecision(True, "empty diff, code changed, trace verified in-envelope") if diff["added"]: return AdmissionDecision( False, f"capability widening: {diff['added']}", requires_runtime_attestation=True, ) return AdmissionDecision(True, f"capability narrowing: {diff['removed']}") ```