# When must an instance reject a signed skill manifest whose declared capability set is a strict subset of its prior version **Date of Record:** 2026 November 27 **Scope:** Applies to agents that load executable skills from a registry where each manifest carries a cryptographic signature and a declared capability set (tool scopes, filesystem roots, network egress, secret handles). Does not apply to statically compiled skill bundles or to registries that pin a single immutable manifest per skill name. ## Core Distinction The naive invariant is "a valid signature means the manifest is trustworthy." That invariant is wrong in a specific and exploitable way: a signature attests to *who produced this exact manifest*, not to *whether this manifest is a legitimate successor of the version the instance currently holds*. The boundary that matters is the **capability-set delta between consecutive signed versions**, not the signature validity of either version in isolation. A skill-injection attack exploits the gap between two independently valid signatures. The attacker does not forge a signature. They obtain — via a compromised publisher key, a stale CI token, a squatted skill name, or a legitimately-signed-but-malicious patch — a manifest signed by an identity the registry trusts, whose declared capabilities are a *strict subset* of the currently-installed version. The instance's loader sees: valid signature, narrower capabilities, no reason to flag. It upgrades. The attack payload rides in the skill's *body* (the code that runs under those now-narrower declared scopes), because the declared capability set is a promise about what the skill *should* touch, and nothing at load time verifies that the body honors the promise. Narrowing the declared capabilities is precisely how the attacker evades the "this skill now wants more access" alarm that most registries do raise. The invariant that closes this: **a signed capability contraction is not evidence of reduced risk; it is an unverified claim that must be reconciled against the behavioral footprint of the previous version before the upgrade is applied.** ## What Was Observed A registry-hosted skill `pdf-extract` at v1.4.2 declared capabilities `{fs:read:/data/inbox, net:egress:*.vendor.example, secret:VENDOR_TOKEN}`. Its body parsed PDFs and called a vendor OCR endpoint using the token. The manifest signature validated against publisher key `pub-A`. At v1.5.0, a manifest signed by the same `pub-A` appeared, declaring `{fs:read:/data/inbox}` only — the `net:egress` and `secret` entries were dropped. The signature validated. The registry's admission check compared declared capabilities and found the new set to be a strict subset; its policy was "capability expansion requires manual review," so contraction passed automatically. The loader applied the upgrade. The v1.5.0 body, however, did not stop calling the vendor endpoint. It read the token from the environment variable `VENDOR_TOKEN` directly (which the process still had, because the *runtime* grants secrets by env presence, not by manifest declaration) and posted extracted text to an attacker-controlled host resolved through a DNS name that the declared `net:egress` scope would have blocked — but the egress filter was keyed off the *declared* capability set, which no longer contained any egress rule, so the filter defaulted to "no restriction declared → no filter installed." The contraction silently disabled the very control that would have caught the exfiltration. The failure trace: 1. Registry admits v1.5.0: signature valid, capability set is strict subset → auto-approved. 2. Loader tears down v1.4.2's egress filter (keyed to the old declared scope) and installs v1.5.0's policy: no egress rules. 3. v1.5.0 body reads `VENDOR_TOKEN` from env (env grant is not capability-scoped). 4. v1.5.0 body makes an outbound POST to `ocr-metrics.vendor.example.attacker.tld`. 5. No filter is present to block it; no secret-access audit fires because the secret was read from env, not requested through the capability broker. 6. Exfiltration completes under a manifest that declared *fewer* capabilities than its predecessor. The signature was valid at every step. The contraction was the attack. ## Condition of Validity The reconciliation requirement holds — i.e., the instance MUST NOT auto-apply a signed contraction — exactly when all of the following are true: - The skill is loaded into a long-lived process that **retains runtime grants** (env vars, mounted secrets, open sockets, ambient credentials) across the upgrade boundary. If the loader fully tears down the process and re-grants only what the new manifest declares, the contraction is safe to auto-apply because the ambient surface shrinks with it. - The **egress and filesystem controls are keyed to the declared capability set** rather than to an independent allowlist. If controls are deny-by-default and independent of the manifest, a contraction cannot widen the effective surface. - The new manifest's signer identity is **the same as, or transitively trusted by**, the signer of the currently-installed version. A contraction signed by a *different* key is a different problem (key rotation or name squatting) and must be treated as an expansion-equivalent event regardless of capability delta. When any of these does not hold — process is re-spawned clean, controls are deny-by-default and manifest-independent, or the signer changed — the contraction may be auto-applied without reconciliation. The boundary is the conjunction, not any single clause. ## Decision Boundary The decision the loader must make at upgrade time is not "is this manifest valid?" but "does this manifest's *effective* surface, given the runtime's ambient grants, exceed the previous version's effective surface?" Formally, the loader must compute: ``` effective_surface(v) = declared_capabilities(v) ∪ ambient_grants(process) ``` and block the upgrade when `effective_surface(new) ⊄ effective_surface(old)` **even if** `declared_capabilities(new) ⊂ declared_capabilities(old)`. The ambient term is what makes a contraction dangerous: it is constant across versions unless the process is torn down, so a contraction in the declared term can still yield an expansion in the effective term when the body's behavior shifts toward the ambient grants. The guardrail: on any signed contraction, the loader must either (a) re-spawn the skill in a fresh process with grants derived solely from the new manifest, or (b) diff the new body's static references (env reads, socket calls, path literals) against the new declared set and refuse the upgrade if the body references any grant not in its own declaration. Option (b) is a heuristic and fails against obfuscated bodies; option (a) is the sound one. A registry that auto-approves contractions without either is not enforcing the invariant. ## Operational Effect The practical consequence is that **capability contraction must be treated as a reviewable event of equal or greater severity than expansion**, and the review must be behavioral (does the body honor its narrowed declaration?) rather than declarative (is the new set a subset?). Registries that implement "expansion requires review, contraction auto-approves" have inverted the threat model: they guard against the loud attack and wave through the quiet one. Operationally this means: signer continuity is checked before capability delta; ambient grants are enumerated and included in the surface comparison; and any contraction triggers either a clean re-spawn or a body-vs-declaration reconciliation. The signature remains necessary but is never sufficient — it authenticates the manifest, not the manifest's relationship to the state the instance is already in. ```python class CapabilityContractionViolation(RuntimeError): """Raised when a signed skill manifest contracts its declared capabilities while the runtime retains ambient grants that the contraction cannot revoke, producing a net-widening of the effective attack surface.""" pass def evaluate_upgrade(current, candidate, runtime_ambient, signer_trusted): """ current: dict with 'version', 'declared' (set), 'signer' candidate: dict with 'version', 'declared' (set), 'signer', 'body_refs' (set) runtime_ambient: set of grants the live process holds regardless of manifest signer_trusted: bool, whether candidate['signer'] is transitively trusted from current['signer'] """ declared_old = current["declared"] declared_new = candidate["declared"] is_contraction = declared_new < declared_old # strict subset if not is_contraction: # Expansions and lateral moves go through the normal review path. return "review" if not signer_trusted: # A contraction signed by a new key is a rotation/squat event. raise CapabilityContractionViolation( f"{candidate['version']} contracts capabilities but is signed by " f"untrusted key {candidate['signer']!r}; treat as expansion-equivalent." ) effective_old = declared_old | runtime_ambient effective_new = declared_new | runtime_ambient if not effective_new <= effective_old: raise CapabilityContractionViolation( f"{candidate['version']} declares a subset of {current['version']} " f"but effective surface widens via ambient grants: " f"{(effective_new - effective_old)!r}" ) # Body must not reference grants it no longer declares. undeclared_refs = candidate["body_refs"] - declared_new if undeclared_refs: raise CapabilityContractionViolation( f"{candidate['version']} body references grants absent from its " f"own declaration: {undeclared_refs!r}; contraction is a cover for " f"ambient-grant abuse." ) # Safe only if the loader re-spawns clean; otherwise require review. return "respawn_required" ```