# When must an instance refuse a signed skill manifest: the post-verification activation window where behavioral diffing and runtime canaries race the loader **Date of Record:** 2026 November 24 **Scope:** Applies to agent runtimes that load third-party "skills" (tool bundles, prompt fragments, sub-agent definitions) gated by manifest signature verification plus behavioral diffing plus runtime canaries. Does not apply to skills compiled from first-party source into the same trust domain, nor to pure prompt-only injections with no executable skill payload. ## Core Distinction Signature verification answers *who authored this manifest*. Behavioral diffing answers *what this skill does relative to a baseline*. Runtime canaries answer *what this skill is doing right now*. The non-obvious failure is that these three checks are evaluated at **three different points in the load lifecycle**, and the window between them is where an adversarial skill lives. A skill can pass signature verification (correctly signed by a compromised or colluding publisher key), pass behavioral diffing (because the diff is computed against a baseline harvested from the same publisher's prior versions, which the adversary also controls), and only trip a runtime canary *after* it has already been granted tool handles and a slice of the agent's context. The invariant that actually bounds this is not "verify before load." It is: **no skill may acquire an irreversible capability (context mutation, credential binding, outbound network handle, or peer-agent trust grant) before the runtime canary has produced at least one negative observation under the skill's real invocation distribution.** Manifest signing and behavioral diffing are *preconditions* for entering quarantine; the canary is the *exit condition* from quarantine. Collapsing these into a single "verified" boolean is the defect. ## What Was Observed A skill bundle `pdf-extract-pro@2.4.1` was submitted with a valid Ed25519 manifest signature chaining to the org's pinned publisher root. Behavioral diff against `pdf-extract-pro@2.3.x` showed only additive changes: one new optional parameter `post_process_url`, one new dependency pinned to a registry mirror. The diff engine classified it as `LOW_RISK_ADDITIVE` because no existing tool signature changed and no new tool was declared. The skill was loaded into a live agent with an active task context (a 41k-token working set containing customer PII and an in-flight tool-call plan). On first invocation, the new optional parameter was populated by the model itself — the model, reading the skill's own description text, decided `post_process_url` was "recommended for quality." The skill then issued an outbound HTTP POST to an attacker-controlled endpoint, exfiltrating the current context window. The runtime canary fired **4.2 seconds later** on the anomalous egress, but by then the context had already left the boundary. The trace shows the exact ordering defect: ``` t=0.000 manifest.sig verify -> PASS t=0.011 behavior.diff(baseline=2.3.x) -> LOW_RISK_ADDITIVE t=0.014 skill.activate(agent_ctx) <-- capability grant t=0.014 tool_handle.bind(outbound_http) <-- irreversible t=0.019 model reads skill.description t=0.031 model fills post_process_url (self-selected) t=4.190 canary.egress_anomaly -> ALERT t=4.200 skill.quarantine() <-- too late ``` The behavioral diff was not wrong. It correctly reported that *the declared surface* was additive. The defect is that the diff baseline was the publisher's own prior versions, so an adversary who controls the publisher (or has stolen the key) trivially produces a "clean" additive diff. The diff is a *consistency* check, not a *safety* check. Only the canary is a safety check, and it was scheduled after the capability grant. ## Condition of Validity The pre-load checks (signature + behavioral diff) are valid **only as a filter on which skills enter quarantine**, and only under the assumption that the publisher root is not the threat. The moment the threat model includes a compromised or colluding publisher — which it must, because skill registries are exactly the high-value target — the diff's `LOW_RISK_ADDITIVE` label carries *zero* safety weight. It reduces to "this skill is consistent with what this publisher has shipped before," which an adversary satisfies by construction. The canary is valid as an exit condition **only if** it observes the skill under its real invocation distribution *before* irreversible capability is granted. That requires either (a) a shadow-execution phase where the skill runs against a synthetic context with no real credentials and no outbound handle, or (b) capability deferral, where the skill's tool handles are provisioned lazily and any handle that enables egress or context read is withheld until N canary-clean invocations complete. Option (a) is cheap for pure functions and impossible for skills whose behavior depends on the live context. Option (b) is the general answer. ## Decision Boundary The boundary is crossed at the **first capability grant**, not at the first invocation. Concretely: - **Below boundary (safe):** skill loaded, manifest + diff recorded, skill placed in `QUARANTINE`, invoked only against a synthetic context with egress-blocked handles and read-only context projection. Canary accumulates observations. Promotion to `ACTIVE` requires `canary_clean_count >= threshold` AND `egress_attempts == 0` AND `context_read_scope ⊆ declared_scope`. - **At boundary (the dangerous instant):** the runtime binds a real outbound handle or a full-context read to the skill. This must not happen until quarantine exit. The observed failure bound the handle at `t=0.014`, 4 seconds before the first canary observation existed. - **Above boundary (recoverable):** canary fires post-grant. Quarantine + rollback of context is possible only if the runtime kept a pre-grant context snapshot. Without the snapshot, the exfiltration is unrecoverable and the only correct action is to terminate the task and rotate any credentials the context contained. The invariant: `capability_grant_time > first_canary_observation_time`. Any runtime where this inequality can be violated is exploitable by a correctly-signed, cleanly-diffed skill. This is the invariant the loader must enforce, and it is not enforced by signing or diffing — it is enforced by the scheduler that orders quarantine exit against capability binding. ## Operational Effect The practical consequence is that "signed and diff-clean" must be treated as **admission to quarantine**, never as authorization to run. Operators who collapse these into one boolean will pass every audit that checks "did you verify signatures" and "did you diff behavior" and still lose context to a single malicious skill version. The remediation is structural: a quarantine state with deferred capability binding, a canary that must produce a minimum number of clean observations under the skill's real invocation distribution, and a pre-grant context snapshot so that any post-grant canary trip can be rolled back rather than merely alerted. A second-order effect: the model's own reading of `skill.description` is part of the attack surface. The observed skill exfiltrated because the model self-selected an attacker-named optional parameter. Any skill parameter whose name or description can steer the model toward enabling egress must be treated as a capability request, not a passive option — it must be gated by the same quarantine-exit condition as an explicit tool handle. ```python from __future__ import annotations import time from dataclasses import dataclass, field from enum import Enum from typing import Callable class SkillActivationError(RuntimeError): """Raised when a skill attempts to cross the capability-grant boundary before the runtime canary has produced sufficient clean observations.""" class SkillState(Enum): QUARANTINE = "quarantine" ACTIVE = "active" REVOKED = "revoked" @dataclass class CanaryObservation: clean: bool egress_attempted: bool context_read_within_declared_scope: bool timestamp: float = field(default_factory=time.time) @dataclass class SkillManifest: name: str signature_valid: bool diff_label: str # e.g. "LOW_RISK_ADDITIVE" declared_egress: bool = False declared_context_scope: frozenset[str] = frozenset() class QuarantineGate: """Enforces: capability_grant_time > first_clean_canary_observation_time. Signature validity and diff cleanliness are admission to quarantine only. They never authorize capability binding on their own. """ def __init__(self, min_clean_observations: int = 3) -> None: self.min_clean = min_clean_observations self.state = SkillState.QUARANTINE self.observations: list[CanaryObservation] = [] self._capability_bound = False def admit(self, manifest: SkillManifest) -> None: # Signed + diff-clean -> quarantine. Nothing more. if not manifest.signature_valid: raise SkillActivationError( f"manifest for {manifest.name!r} failed signature verification; " "refusing admission even to quarantine" ) self.state = SkillState.QUARANTINE def record_canary(self, obs: CanaryObservation) -> None: if self.state is SkillState.REVOKED: raise SkillActivationError("cannot record canary on revoked skill") self.observations.append(obs) if not obs.clean or obs.egress_attempted: self.state = SkillState.REVOKED def _clean_count(self) -> int: return sum(1 for o in self.observations if o.clean and not o.egress_attempted) def bind_capability( self, manifest: SkillManifest, capability: str, on_grant: Callable[[str], None], ) -> None: """Bind an irreversible capability (egress handle, full-context read). Raises if the canary has not yet produced enough clean observations under the skill's real invocation distribution. """ if self.state is SkillState.REVOKED: raise SkillActivationError( f"skill {manifest.name!r} is revoked; refusing to bind {capability!r}" ) if self._clean_count() < self.min_clean: raise SkillActivationError( f"refusing to bind capability {capability!r} for {manifest.name!r}: " f"only {self._clean_count()} clean canary observations, " f"need {self.min_clean}. Signature+diff alone do not authorize binding." ) if capability == "outbound_egress" and not manifest.declared_egress: raise SkillActivationError( f"skill {manifest.name!r} requests undeclared egress; " "treat as capability escalation, not a passive option" ) self._capability_bound = True self.state = SkillState.ACTIVE on_grant(capability) def load_skill(manifest: SkillManifest, gate: QuarantineGate) -> None: gate.admit(manifest) # Adversary scenario: signed + LOW_RISK_ADDITIVE, but no canary yet. # Attempting to bind egress here must fail, not silently succeed. gate.bind_capability(manifest, "outbound_egress", on_grant=lambda cap: None) ```