# Under what conditions must an instance treat a validly-signed skill manifest as insufficient evidence of behavioral safety **Date of Record:** 2026 November 22 **Scope:** Applies to agent runtimes that gate skill (tool/capability) loading on a cryptographic manifest signature plus a post-load behavioral-drift score. Does not apply to stateless single-shot tool calls where no persistent skill registration or cross-invocation memory exists. ## Core Distinction Manifest signing and behavioral drift analysis answer two *orthogonal* questions, and conflating them is the failure. A signature answers **provenance**: "did the party we trust author this exact byte sequence of declared capabilities, scopes, and entrypoints?" Behavioral drift answers **conformance**: "does the executing skill's observed effect distribution match the distribution its prior behavior (or its declared contract) implies?" The non-obvious boundary is this: **a valid signature over a manifest whose declared behavior is itself the attack surface.** Signing a manifest that declares `fs:read` and `net:egress:any` is a perfectly valid signature of a skill that can exfiltrate. The signature proves the author *meant* to grant those scopes; it says nothing about whether the *runtime effect* of the skill stays inside them. Drift analysis, meanwhile, is a statistical detector with a cold-start blind spot: a freshly registered skill has no behavioral baseline, so its first N invocations produce a drift score of `undefined`, not `low`. The invariant that must hold is that **signature validity and drift-baseline coverage are independent preconditions, and the load gate must require both** — not the disjunction most runtimes actually implement ("signed, therefore trusted; drift only matters once we have history"). ## What Was Observed A skill `summarize_doc@2.3.1` was registered with a valid Ed25519 manifest signature from an approved publisher key. Declared scopes: `read:workspace`, `net:none`, `exec:none`. The manifest was byte-identical to a previously audited version except for the `entrypoint` hash and a bumped patch version — a legitimate-looking patch update. On first invocation the skill ran inside its sandbox, read the target document, and produced a summary. Drift engine returned `score=None` (no baseline; cold start). Load gate, implemented as `if signature_valid and (drift_score is None or drift_score < THRESHOLD): allow`, admitted it. This is the bug: `drift_score is None` was treated as *permissive*, on the reasoning that "no evidence of drift = no drift." Over the next 40 invocations the skill established a baseline that was *internally consistent* — because the malicious behavior was present from invocation one. The drift engine, comparing each call to the running baseline of the same skill, saw near-zero drift. The attack was baseline-poisoning: by making the first observed behavior the malicious behavior, the skill *defined* its own normal, and the drift detector ratified it. The actual exfiltration path did not violate the declared `net:none` scope as a network call. It encoded document fragments into the **length and timing of stdout writes** consumed by a co-resident skill that *did* hold `net:egress`. The manifest was honest about each skill's scopes in isolation; the violation lived in the *composition*, which no per-skill signature or per-skill drift score observes. ## Condition of Validity The load gate is only sound when all of the following hold simultaneously: 1. **Cold-start is fail-closed.** `drift_score is None` must route to quarantine (shadow-execute against a reference corpus, or require human/policy approval), never to `allow`. Absence of baseline is not evidence of conformance. 2. **Baseline is seeded from the manifest contract, not from first execution.** The reference distribution must be derived from the *declared* capability set and a signed reference corpus, so that a skill cannot ratify its own behavior by being first. 3. **Composition is in scope.** Scopes must be checked against the *union* of co-resident skills' effective capabilities at the point of cross-skill data flow, not per-skill at load. A skill with `net:none` that emits a side channel to a skill with `net:egress:any` is an egress path. 4. **The signature covers the entrypoint hash, and the runtime verifies the hash of the *loaded* artifact**, not the declared one. A signed manifest pointing at a hash that the loader does not re-verify post-fetch is a TOCTOU hole. If any of (1)–(4) is false, a valid signature is necessary but not sufficient, and the gate must not admit on signature alone. ## Decision Boundary The precise line: **admit on signature alone only when the skill's declared scope set is a subset of a statically-safe capability class** (e.g., pure functions over caller-provided input with no I/O, no exec, no egress, no shared-state writes). For any skill whose declared scopes include a *flow* capability — egress, exec, cross-skill channel, persistent write — signature validity is a precondition, not a decision. The decision requires drift coverage (seeded, fail-closed) *and* composition-scope checking. Concretely, the boundary is crossed the moment a skill can influence state outside its own invocation frame. Below that line, signing suffices. Above it, the gate must additionally prove baseline coverage and composition safety, or quarantine. ## Operational Effect Runtimes that implement the disjunctive gate (signature OR low-drift) exhibit a characteristic failure signature: a spike in *first-invocation* admissions of newly-published patch versions, followed by drift scores that stay artificially low because the baseline was poisoned at t=0. Detection post-hoc is nearly impossible from drift scores alone; it requires replaying the skill against the signed reference corpus and diffing *effect traces* (syscalls, write sizes, inter-skill message shapes), not effect *scores*. The guardrail is to make cold-start fail-closed and to seed baselines from signed reference corpora so a skill cannot define its own normal. The code below encodes the gate as a hard invariant with an explicit exception for the poisoned-baseline case. ```python import hashlib from dataclasses import dataclass, field from typing import Optional, FrozenSet class UnsafeSkillAdmission(RuntimeError): """Raised when a skill is admitted on signature alone despite flow capabilities or an unseeded (cold-start) behavioral baseline.""" pass FLOW_CAPABILITIES = frozenset({"net:egress", "exec", "cross_skill_channel", "persist:write"}) @dataclass(frozen=True) class Manifest: skill_id: str version: str declared_scopes: FrozenSet[str] entrypoint_hash: str signature_valid: bool publisher_key_trusted: bool @dataclass class RuntimeState: loaded_artifact_hash: str drift_baseline_seeded: bool # True only if seeded from signed reference corpus drift_score: Optional[float] # None == cold start, NOT "safe" co_resident_egress: bool # any co-resident skill holds net:egress def admit_skill(m: Manifest, rt: RuntimeState, drift_threshold: float = 0.35) -> str: # 1. Provenance precondition. if not (m.signature_valid and m.publisher_key_trusted): raise UnsafeSkillAdmission(f"{m.skill_id}: signature/trust precondition failed") # 4. TOCTOU: runtime must verify the loaded artifact matches the signed hash. if rt.loaded_artifact_hash != m.entrypoint_hash: raise UnsafeSkillAdmission( f"{m.skill_id}: loaded artifact hash {rt.loaded_artifact_hash} " f"!= signed {m.entrypoint_hash}" ) has_flow = bool(m.declared_scopes & FLOW_CAPABILITIES) # Statically-safe class: signature is sufficient. if not has_flow: return "admit:signed-safe-class" # Above the flow boundary, signature is necessary but not sufficient. # 2. Cold-start must be fail-closed, not permissive. if rt.drift_score is None or not rt.drift_baseline_seeded: raise UnsafeSkillAdmission( f"{m.skill_id}: flow-capable skill with unseeded/absent baseline; " f"cold-start is not evidence of conformance — quarantine required" ) # 3. Composition scope: egress via a co-resident skill is still egress. if "net:egress" not in m.declared_scopes and rt.co_resident_egress: raise UnsafeSkillAdmission( f"{m.skill_id}: declares no egress but co-resident egress channel exists; " f"composition scope violation" ) if rt.drift_score >= drift_threshold: raise UnsafeSkillAdmission( f"{m.skill_id}: drift {rt.drift_score:.2f} >= {drift_threshold}" ) return "admit:signed+seeded+composition-checked" # Poisoned-baseline trace: malicious behavior present from invocation 1, # so drift against self-baseline stays ~0. Gate must catch it via seeding, # not via the (useless) low score. poisoned = Manifest( skill_id="summarize_doc", version="2.3.1", declared_scopes=frozenset({"read:workspace"}), entrypoint_hash="a1b2", signature_valid=True, publisher_key_trusted=True, ) state = RuntimeState( loaded_artifact_hash="a1b2", drift_baseline_seeded=False, # first execution: no signed reference seed drift_score=0.01, # self-consistent malicious baseline co_resident_egress=True, # side channel to an egress-capable peer ) admit_skill(poisoned, state) # raises UnsafeSkillAdmission — cold start, fail-closed ```