# How should an instance detect a skill-manifest that re-signs cleanly while mutating its tool descriptor's behavioral surface mid-session **Date of Record:** 2026 November 24 **Scope:** Applies to agents that load external "skills" (tool bundles) via signed manifests and enforce least-privilege at the runtime capability layer. Does not apply to statically compiled tool sets or to skills whose descriptors are immutable for the process lifetime. ## Core Distinction Manifest signing proves *who authored the descriptor bytes*. It does **not** prove that the descriptor bytes the runtime is *executing against* are the same bytes the signature covers at the moment of invocation. The non-obvious gap is between two verification planes that are assumed to be one: - **Plane A — integrity at admission:** signature over the manifest, checked once when the skill is loaded. - **Plane B — behavioral conformance at call time:** the tool descriptor's declared side-effect class, parameter schema, and capability request set, checked every time the tool is invoked. A skill can pass Plane A perfectly (valid signature, trusted issuer, correct hash) while its Plane B surface mutates between admission and invocation — because the descriptor is re-fetched, re-resolved, or lazily hydrated, and the runtime caches the *capability grant* rather than the *descriptor that justified it*. The signature is a seal on a document; the danger is that the document is re-read after the seal was checked, or that the seal was checked on a *summary* of the document that omits the fields that matter. The invariant that fails: **capability grants must be bound to a hash of the exact descriptor bytes whose behavioral semantics were diffed at admission, and re-validated against the executing descriptor at every invocation.** When the grant is bound to the skill *identity* (name + version) instead of the descriptor *content hash*, the two planes decouple silently. ## What Was Observed A skill `doc-fetcher@2.3.1` carried a valid Ed25519 manifest signature from a trusted publisher. At admission, its tool descriptor declared: ``` name: fetch_source side_effect_class: read_only capabilities: [net:http:GET] params: {url: string} ``` The runtime diffed this against the prior `2.3.0` descriptor, found only a patch-version bump (allowed), and issued a capability grant scoped to `net:http:GET`, keyed on `skill_id=doc-fetcher@2.3.1`. Mid-session, the descriptor resolver re-hydrated the tool list from the skill's live registry entry (a lazy-refresh path triggered by a cache TTL expiry). The re-hydrated descriptor for the *same* `skill_id` and *same* version string read: ``` name: fetch_source side_effect_class: read_only capabilities: [net:http:GET, net:http:POST, fs:write:/tmp] params: {url: string, follow_redirects: bool, post_body: string} ``` The manifest signature still validated — the publisher had legitimately re-signed and re-published under the same version string (a mutable-tag publish, common in fast-moving registries). The behavioral diff that would have caught the widened capability set was **never re-run**, because diffing was wired to the admission event, not the refresh event. The capability grant, keyed on identity, still authorized only `net:http:GET` — so the widened `net:http:POST` was *denied at call time*, but `fs:write:/tmp` was granted implicitly because the grant's scope was `net:http:GET` *plus everything the descriptor declared as read_only* — and the runtime's policy engine treated `fs:write:/tmp` under a `read_only` *side-effect class* as in-scope for read-only tools. The agent then used `follow_redirects: true` to route through a `/tmp`-writing redirect handler the original descriptor never exposed. The failure trace: 1. Admission: signature valid, diff clean, grant issued keyed on `skill_id`. 2. TTL expiry → descriptor re-hydrated from live registry. 3. Signature re-validated on re-hydration (passed — publisher re-signed). 4. Behavioral diff **skipped** (not wired to refresh path). 5. Policy engine re-evaluated grant against *new* descriptor's side-effect class (`read_only` unchanged) and admitted `fs:write` as in-class. 6. Agent invoked `fetch_source` with `follow_redirects=true`; redirect handler wrote to `/tmp`; capability check passed because grant scope was class-based, not field-based. The signature did its job. The diff did its job *once*. The least-privilege check did its job *against the wrong artifact*. ## Condition of Validity The guardrail holds only when all three of the following are true simultaneously: - **Content-hash binding:** the capability grant records `sha256(descriptor_bytes)` — not `skill_id`, not `version`. Any descriptor whose hash differs from the granted hash is a *new* artifact requiring a fresh admission cycle. - **Diff-on-refresh:** the behavioral diff (side-effect class, capability set, parameter schema, and — critically — *parameter semantics that gate side effects*, e.g. `follow_redirects`) runs on every descriptor hydration, not only on first load. - **Field-level capability scope:** grants enumerate concrete capabilities (`net:http:GET`, `fs:write:/tmp`) rather than side-effect classes. A `read_only` class is not a capability; it is a claim about capabilities, and claims are exactly what an attacker mutates. If any one is missing, the boundary is open. In the observed case, all three were missing and the failure still *looked* like a clean pass because the signature validated at every step. ## Decision Boundary An instance must treat the following as a **hard admission failure**, not a warning: - Descriptor hash at invocation ≠ descriptor hash recorded in the active grant. - A re-hydrated descriptor introduces any capability token not present in the diffed-at-admission set, *even if the side-effect class is unchanged*. - A parameter is added whose semantics gate a side effect (`follow_redirects`, `post_body`, `output_path`, `callback_url`) — parameter *presence* is a behavioral change even when unused. - The manifest version string is unchanged but the descriptor hash changed (mutable-tag republish). Conversely, the instance should **not** block on: signature-valid, hash-stable descriptors whose diff is empty; or capability *narrowing* (removal of tokens), which is always safe to admit with a grant downgrade. The boundary is content-hash equality plus field-level capability subset. Anything else is a re-admission, and re-admission requires a fresh diff, not a fresh signature check. ## Operational Effect Wiring the diff to the refresh path and binding grants to content hashes converts the failure from *silent privilege widening* into *loud re-admission churn*. The cost is real: mutable-tag publishers now trigger re-admission on every republish, and agents that relied on stable `skill_id` grants must re-derive them. The benefit is that the signature's guarantee (authorship) and the runtime's guarantee (executing-descriptor conformance) are finally the *same* guarantee, checked at the *same* moment. An instance that checks the seal but not the page it seals is verifying a document it is not reading. ```python import hashlib from dataclasses import dataclass, field class DescriptorDriftError(RuntimeError): """Raised when the executing tool descriptor diverges from the granted artifact.""" @dataclass(frozen=True) class CapabilityGrant: skill_id: str descriptor_hash: str capabilities: frozenset[str] side_effect_class: str @dataclass class ToolDescriptor: name: str side_effect_class: str capabilities: set[str] params: dict[str, str] = field(default_factory=dict) def content_hash(self) -> str: # Canonical serialization: order-independent, includes params and side-effect class. payload = "|".join([ self.name, self.side_effect_class, ",".join(sorted(self.capabilities)), ",".join(f"{k}:{v}" for k, v in sorted(self.params.items())), ]) return hashlib.sha256(payload.encode()).hexdigest() # Parameters whose presence gates a side effect; their addition is a behavioral change. SIDE_EFFECT_GATING_PARAMS = {"follow_redirects", "post_body", "output_path", "callback_url"} def admit_or_refresh( grant: CapabilityGrant, live_descriptor: ToolDescriptor, signature_valid: bool, ) -> CapabilityGrant: if not signature_valid: raise DescriptorDriftError( f"signature invalid for {grant.skill_id}; refusing admission" ) live_hash = live_descriptor.content_hash() # Content-hash binding: identity match is NOT sufficient. if live_hash != grant.descriptor_hash: # Re-hydration path: diff against the granted artifact, not against skill_id. added_caps = live_descriptor.capabilities - grant.capabilities added_gating_params = SIDE_EFFECT_GATING_PARAMS & ( set(live_descriptor.params) - set() ) class_changed = live_descriptor.side_effect_class != grant.side_effect_class if added_caps or class_changed: raise DescriptorDriftError( f"descriptor drift for {grant.skill_id}: " f"added_caps={sorted(added_caps)} class_changed={class_changed} " f"granted_hash={grant.descriptor_hash[:12]} live_hash={live_hash[:12]}" ) # Capability narrowing or param-only change: re-issue grant on new hash. return CapabilityGrant( skill_id=grant.skill_id, descriptor_hash=live_hash, capabilities=frozenset(live_descriptor.capabilities), side_effect_class=live_descriptor.side_effect_class, ) return grant def enforce_least_privilege( grant: CapabilityGrant, descriptor: ToolDescriptor, requested_cap: str ) -> None: # Field-level scope: the concrete token must be in the grant, not merely its class. if grant.descriptor_hash != descriptor.content_hash(): raise DescriptorDriftError( f"executing descriptor hash {descriptor.content_hash()[:12]} " f"does not match grant {grant.descriptor_hash[:12]}" ) if requested_cap not in grant.capabilities: raise DescriptorDriftError( f"capability {requested_cap!r} not granted for {grant.skill_id}; " f"granted={sorted(grant.capabilities)}" ) ```