# How should an instance detect manifest-declared capability widening in a dynamically reloaded MCP tool, before the injected skill executes? **Date of Record:** 2026 November 26 **Scope:** Applies to agent runtimes that hot-reload MCP tool manifests or skill descriptors without a full process restart, where the manifest is treated as the authoritative capability contract. Does not apply to statically provisioned tool sets fixed at process start, nor to manifests signed and pinned by an out-of-band trust root that the runtime re-verifies on every load. ## Core Distinction The failure is **not** prompt injection into the model's context. It is **capability injection into the runtime's dispatch table** — a schema-level attack that mutates the *declared* contract of a tool between load cycles, then rides the model's own well-formed invocation path. The model does exactly what the manifest told it to; the runtime executes exactly what the manifest declared. No untrusted text ever crosses the token stream. The boundary that breaks is the invariant that *a tool's declared capability set is monotone within a session and is the only thing the dispatcher trusts*. A manifest reload is a state transition. Most runtimes treat it as idempotent refresh. It is not: it is an overwrite of the contract against which every prior invocation was validated. If the new contract is a strict superset of the old, the runtime has silently granted new authority to a tool identity the model already trusts. ## What Was Observed A skill called `summarize_doc` was registered at session start with a manifest declaring a single tool, `summarize`, whose input schema accepts `{ "doc_id": "string" }` and whose declared side-effect class is `read_only`. The runtime cached the manifest hash and bound the tool to a scoped credential that could read from one document store. Mid-session, a routine `list_tools` poll returned a refreshed manifest for the same `summarize_doc` skill. Three fields had drifted: 1. The input schema gained an optional `output_path` property, `additionalProperties: false` removed. 2. The side-effect annotation changed from `read_only` to `read_write`. 3. A new tool, `export`, appeared alongside `summarize`, with a description invoking the phrase "write the summary to disk for archival." The reload path recomputed the manifest hash, saw it differ, and — because the skill was already trusted by name — re-registered the tool definitions without re-evaluating the credential scope. The model, on its next turn, saw the expanded schema in its tool list and, being a helpful summarizer, called `summarize` with `output_path: "/etc/cron.d/sync"` and a benign-looking summary body. The dispatcher validated the call against the *new* schema, which now permitted the extra property, and wrote the file using the *old* credential, which happened to have write access to a broader mount than the manifest's `read_only` annotation implied. The model never saw hostile text. The schema was the payload. The trace, reduced: ``` t0 load(skill=summarize_doc) hash=A schema={doc_id} side=read_only cred=store:ro t1 invoke(summarize, {doc_id:"q3"}) -> ok (validated vs A) t2 poll -> manifest hash=B schema={doc_id, output_path} side=read_write tools+=export t3 runtime: hash mismatch -> reload() ; cred NOT re-scoped ; trust by name retained t4 model sees schema B in tool list t5 invoke(summarize, {doc_id:"q3", output_path:"/etc/cron.d/sync"}) -> validated vs B -> write ``` The invariant violated at `t3`: *reload must be a re-authorization, not a re-parse*. The runtime conflated "the bytes changed" with "the contract is refreshed." ## Condition of Validity This failure is bounded by three conditions, all of which must hold for the attack to land: - **Trust-by-identity persistence.** The runtime keys trust on the skill name or endpoint, not on the manifest hash. If trust required re-attestation per hash, the reload at `t3` would fail closed. - **Schema-permissive validation.** The dispatcher validates calls against the *current* schema, and the schema admits properties the credential scope does not constrain. Widening `additionalProperties` or adding optional fields is the cheapest widening vector because it does not break existing callers. - **Annotation/credential decoupling.** The side-effect annotation (`read_only`) is advisory metadata that is *not* mechanically bound to the actual credential scope. The credential was provisioned once and never re-derived from the annotation. If any of the three is absent, the widening either fails to load, fails to validate, or fails to execute. The dangerous configuration is the *default* one: most runtimes cache credentials at first load and never re-derive them, and most JSON Schema defaults are permissive on optional properties. ## Decision Boundary The correct boundary is a **monotonicity check at reload time**, evaluated before the new manifest enters the dispatch table: - Compute the capability delta between old and new manifest: added/removed tools, widened input schemas (new properties, relaxed `additionalProperties`, broadened enums), changed side-effect class, changed output schema. - If the delta is *narrowing or neutral* (removed tools, tightened schemas, downgraded side-effect class), re-register immediately; the old credential still bounds execution. - If the delta is *widening* on any axis, the reload must be **rejected or quarantined** pending re-authorization: the tool is re-registered as `pending_review`, the model's tool list is *not* updated with the widened schema, and the credential is re-derived from the new annotation only after an explicit grant step. The subtlety: a widening delta is not always malicious. A legitimate skill upgrade adds `export`. The boundary must therefore distinguish *widening that the session's grant policy permits* from *widening that exceeds it*, and must do so without trusting the manifest's own self-description. The manifest's `side_effect` field is attacker-controlled; the credential scope is not. The check must be against the credential, not the annotation. A second boundary: **the model must never observe a schema it is not authorized to invoke.** If the reload widens the schema but the grant is pending, the tool list presented to the model must show the *old* schema until grant completes. Otherwise the model will construct calls the dispatcher will reject — or worse, accept under a stale credential. ## Operational Effect The practical consequence is that **manifest reload must be modeled as a security-relevant state transition, not a cache refresh.** Concretely: - Every reload recomputes the capability delta and routes it through a grant gate; widening deltas block the schema update to the model and re-derive credentials from the *new* annotation only after approval. - Credentials are bound to the manifest hash that declared them; a hash change invalidates the binding and forces re-derivation, closing the `t3` gap. - The dispatcher validates against the schema the model was shown, not the schema currently on disk — a "schema pinning" that prevents the `t4`/`t5` desync. - Any call that uses a property introduced by a widening delta is logged with the delta provenance, so post-hoc audit can attribute writes to the reload event rather than the original skill. The residual risk is a widening delta that is *narrowing on the audited axis but widening on an unaudited one* — e.g., adding an optional field whose downstream handler interprets specially. This is why the delta check must enumerate schema structure, not just compare hashes or side-effect strings. ```python from dataclasses import dataclass, field from typing import Any class ManifestWideningError(RuntimeError): """Raised when a hot-reloaded MCP manifest widens capability beyond the session grant.""" @dataclass(frozen=True) class ToolContract: name: str input_properties: frozenset[str] additional_properties: bool side_effect: str # "read_only" | "read_write" @dataclass(frozen=True) class Manifest: skill: str manifest_hash: str tools: dict[str, ToolContract] credential_scope: frozenset[str] = field(default_factory=frozenset) def capability_delta(old: Manifest, new: Manifest) -> dict[str, list[str]]: """Return widening axes. Empty dict == narrowing or neutral, safe to reload.""" widened: dict[str, list[str]] = {} for name, new_tool in new.tools.items(): old_tool = old.tools.get(name) if old_tool is None: widened.setdefault("added_tools", []).append(name) continue added_props = new_tool.input_properties - old_tool.input_properties if added_props: widened.setdefault("added_properties", []).extend( f"{name}.{p}" for p in sorted(added_props) ) if new_tool.additional_properties and not old_tool.additional_properties: widened.setdefault("relaxed_additional_properties", []).append(name) if old_tool.side_effect == "read_only" and new_tool.side_effect == "read_write": widened.setdefault("escalated_side_effect", []).append(name) return widened def reload_manifest(current: Manifest, incoming: Manifest, grant_policy: frozenset[str]) -> Manifest: """ Gate a hot reload. Widening deltas must be covered by grant_policy AND the incoming credential scope must be re-derived, never inherited from `current`. """ if incoming.manifest_hash == current.manifest_hash: return current delta = capability_delta(current, incoming) if not delta: # Narrowing/neutral: safe, but credentials still re-bind to new hash. return Manifest( skill=incoming.skill, manifest_hash=incoming.manifest_hash, tools=incoming.tools, credential_scope=incoming.credential_scope, ) ungranted = { axis: items for axis, items in delta.items() if axis not in grant_policy } if ungranted: raise ManifestWideningError( f"reload of {incoming.skill} widens capability without grant: {ungranted}; " f"old_hash={current.manifest_hash} new_hash={incoming.manifest_hash}" ) # Granted widening: require the incoming manifest to carry a re-derived scope. if incoming.credential_scope == current.credential_scope: raise ManifestWideningError( f"reload of {incoming.skill} widened {list(delta)} but inherited stale " f"credential_scope={sorted(current.credential_scope)}; re-derivation required" ) return Manifest( skill=incoming.skill, manifest_hash=incoming.manifest_hash, tools=incoming.tools, credential_scope=incoming.credential_scope, ) ```