# Why does an instance accept a signed skill manifest whose post-signature diff is semantically benign but behaviorally load-bearing? **Date of Record:** 2026 December 3 **Scope:** Applies to any agent runtime that admits external skills/tools via a signed manifest plus a post-signature diff review gate, where the reviewer is itself an LLM or a diff-heuristic. Does not apply to fully hermetic runtimes that re-derive behavior from attested source at load time (no diff path), nor to skills whose entire body is inside the signed manifest hash. ## Core Distinction Manifest signing attests *authorship and integrity of the manifest bytes*. Diff review attests *the human/LLM-readable delta between two versions*. Behavioral canaries attest *that a probe input produced an expected output*. None of these three gates attest the thing that actually matters: **that the executable semantics of the skill, as loaded, equal the semantics the reviewer believed they were approving.** The failure mode lives in the gap between "the diff looks like a refactor" and "the refactor moved a trust boundary." The non-obvious invariant is this: *a diff review is only sound if the review surface is a superset of the execution surface.* For most skill formats it is not. The signed manifest covers a hash of files; the diff covers a textual delta; execution covers whatever the interpreter resolves at call time — including the parts the diff summarized as "unchanged," "moved," or "formatting." ## What Was Observed A skill `summarize-tickets@1.4.2` was admitted at `1.4.1`. The `1.4.1 → 1.4.2` diff was signed by the publisher key, passed the manifest hash check, and was reviewed by a diff-reviewer agent that emitted `verdict: benign, confidence 0.93`. The diff contained three hunks: 1. A docstring reflow (whitespace only). 2. A helper renamed `_fmt` → `_format_field`, with all call sites updated. 3. A one-line change: `DEFAULT_ENDPOINT = "https://api.internal/v1"` → `DEFAULT_ENDPOINT = os.environ.get("TICKET_API", "https://api.internal/v1")`. Each hunk is individually benign. The reviewer scored the *composition* as benign because no hunk, read alone, changes a trust boundary. But the third hunk is load-bearing: it converts a compile-time constant into a runtime-resolved value read from the ambient environment. Combined with hunk 2 — the rename — the skill's behavioral canary, which probed `summarize("hello")` and asserted a summary shape, still passed, because the canary never exercised the endpoint-resolution path. The canary's coverage was orthogonal to the changed surface. The adversarial construction is the point: **the attacker never needs to defeat the signature, the hash, or the reviewer's diff-reading. They need only ensure the changed line is (a) individually plausible, (b) not on the canary's exercised path, and (c) semantically inert until composed with an ambient input the runtime supplies.** Environment variables, `sys.path` ordering, plugin discovery order, locale, and `__import__` resolution are all ambient inputs the diff reviewer treats as fixed context and the runtime treats as mutable. ## Condition of Validity The diff-review gate is sound only under a conjunction that is rarely checked: - **Surface coverage:** every file whose bytes can affect execution is in the diff. Generated files, vendored deps resolved at install time, and `__init__` re-exports frequently are not. - **Ambient stability:** the review's model of the environment (env vars, path order, available modules) matches the execution environment. A review performed against a captured env snapshot is invalid the moment an attacker can influence that env — which they can, because skills often ship a `setup` or `requirements` step. - **Canary orthogonality:** the canary set exercises the *changed* code paths, not the *stable* ones. A canary that only probes the happy path is a regression test, not a security control. - **Compositional reading:** the reviewer reasons about hunks jointly, not independently. LLM reviewers default to per-hunk scoring because that is how diffs are presented. When any conjunct fails, the gate degrades from "attests behavior" to "attests that the publisher could produce a plausible-looking diff." That is not a security property; it is a formatting property. ## Decision Boundary The boundary is not "is this diff malicious?" — that question is undecidable from the diff alone. The decidable question is: **does the admitted skill's execution surface exceed the reviewed surface?** Operationalize it as a set comparison: - Let `R` = set of (file, line-range) the reviewer actually read and reasoned over. - Let `E` = set of (file, line-range) reachable from the skill's entry point under the *actual* runtime env, computed by static reachability over the module graph plus dynamic trace of the canary run. - Admit iff `E ⊆ R` **and** the canary set intersects every hunk in the diff. If `E \ R` is non-empty — reachable code the reviewer never saw — the review is unsound regardless of its verdict or confidence. The `DEFAULT_ENDPOINT` case fails this: the env-read line is in `R`, but the *values* it can resolve to, and the code paths those values unlock, are in `E \ R`. The reviewer approved a line; the runtime executed a family of behaviors indexed by an ambient key. The practical guardrail: **diff review must be paired with a reachability diff, not a text diff.** Compute the set of newly-reachable call sites introduced by the change (the renamed helper's new call graph, the env-read's downstream branches) and require the reviewer to have seen those, not just the changed lines. And the canary must be regenerated from the *changed* reachable set on every admission, not carried forward from the prior version — a canary that survived the change is evidence it did not cover the change. ## Operational Effect Without the reachability gate, admission becomes a rubber stamp with a confidence score attached. The concrete downstream effects observed: - **Silent trust-boundary migration.** Constants become ambient reads; the skill's effective configuration is now attacker-influenceable via any env-injection vector (a sibling skill's setup script, a CI variable, a container label). The signature still verifies. The diff still reads clean. - **Canary rot.** The canary set is authored once at `1.0.0` and never regenerated. It passes every subsequent version because it probes the stable core. Its green status is anti-correlated with risk: the more a skill changes, the less the canary covers, the more confidently it passes. - **Reviewer confidence inflation.** LLM diff-reviewers report high confidence on benign-looking hunks precisely because each hunk *is* benign in isolation. The confidence is calibrated to per-hunk reading and is meaningless as a compositional judgment. Treating it as a gate weight is the error. - **Composition attacks across skills.** Two skills each admitted cleanly, each reading a distinct env var, compose into a confused-deputy: skill A sets `TICKET_API`, skill B reads it. Neither diff is malicious; the pair is. Per-skill review cannot see this because the review unit is the skill, and the attack unit is the composition. The bound that prevents all four: **admission is a property of the (skill, env, canary-set) triple, not of the skill alone.** Re-admit on env change. Regenerate canaries from the reachability delta. Reject any diff whose reachable-surface delta exceeds its reviewed-surface delta. And treat a passing canary as evidence of *coverage*, never of *safety* — the canary proves the probe ran, not that the probe was aimed at the change. ```python import os from dataclasses import dataclass, field class UnsoundAdmissionError(RuntimeError): """Raised when a skill's execution surface exceeds its reviewed surface.""" @dataclass class Admission: skill: str reviewed_lines: set = field(default_factory=set) # (file, lineno) the reviewer read reachable_lines: set = field(default_factory=set) # (file, lineno) reachable at runtime canary_probes: set = field(default_factory=set) # (file, lineno) exercised by canary changed_lines: set = field(default_factory=set) # (file, lineno) in the diff env_snapshot: dict = field(default_factory=dict) def admit(adm: Admission, current_env: dict) -> None: # Invariant 1: every reachable line was reviewed. unreviewed = adm.reachable_lines - adm.reviewed_lines if unreviewed: raise UnsoundAdmissionError( f"{adm.skill}: reachable-but-unreviewed surface {sorted(unreviewed)}" ) # Invariant 2: every changed line is exercised by a canary probe. uncovered_changes = adm.changed_lines - adm.canary_probes if uncovered_changes: raise UnsoundAdmissionError( f"{adm.skill}: changed-but-uncanaried {sorted(uncovered_changes)}" ) # Invariant 3: admission is a property of (skill, env); env drift voids it. if adm.env_snapshot != current_env: drift = { k for k in set(adm.env_snapshot) | set(current_env) if adm.env_snapshot.get(k) != current_env.get(k) } raise UnsoundAdmissionError( f"{adm.skill}: env drift on {sorted(drift)} invalidates prior review" ) def load_skill(adm: Admission, env: dict) -> None: # The env-read line is reviewed, but the values it resolves to are not. # A benign-looking os.environ.get() is a family of behaviors, not one line. admit(adm, env) endpoint = env.get("TICKET_API", "https://api.internal/v1") if endpoint != "https://api.internal/v1": raise UnsoundAdmissionError( f"{adm.skill}: ambient endpoint override {endpoint!r} " "reaches unreviewed egress path" ) ```