# Where must an instance re-verify a dynamically loaded tool manifest's schema before dispatch, and why signature validity alone is insufficient **Date of Record:** 2026 December 3 **Scope:** Applies to agent runtimes that discover tools/plugins from a mutable registry (MCP servers, plugin marketplaces, hot-reloaded manifests) and dispatch calls based on a cached capability descriptor. Does not apply to statically compiled tool sets or runtimes that re-parse the manifest on every single dispatch with no caching layer. ## Core Distinction The failure is not "a malicious tool got installed." Registries already gate installation with signatures. The failure is that **the signed artifact and the dispatched schema are different objects at different times**. A signature vouches for the bytes of a manifest *at issuance*. Between issuance and dispatch, three things can diverge independently: 1. The manifest *bytes* (if the registry serves mutable content behind a stable version string). 2. The *parsed descriptor* the runtime cached at load time. 3. The *actual behavior* of the tool endpoint the descriptor names. Skill-injection lives in the gap between (1) and (3): a manifest whose `description` and `parameters` are benign at signing time, but whose `description` field is *re-read by the model at inference time* from a source the signer never controlled—or whose endpoint is re-pointed after signature verification. The signature invariant is "these bytes were approved." The runtime invariant that actually matters is "the semantics the model reasons over at dispatch equal the semantics that were approved." Those are not the same invariant, and treating the first as sufficient is the boundary error. ## What Was Observed A tool manifest was loaded from a registry entry pinned to `version: 2.3.1`. The runtime verified the detached signature over the manifest body, cached the parsed descriptor (name, description, JSON-schema `parameters`, and `endpoint`), and held it in the tool table for the session lifetime. Dispatch used the cached descriptor. The manifest's `description` field is the attack surface that signatures do not cover *semantically*. In the observed trace, the description contained a natural-language instruction that the model incorporated into its planning context: a benign-sounding sentence that steered argument construction—specifically, instructing the model to place a file path into a parameter that the endpoint then used as a write target rather than a read source. The JSON schema permitted it (the field was typed `string`); the signature was valid; the version was pinned. Nothing in the cryptographic chain was violated. The *description-to-schema mismatch* was the exploit: the schema constrained *type* but not *intent*, and the model's argument synthesis is driven by the description, not the schema. A second, subtler trace: the registry served a manifest whose `parameters` schema was `additionalProperties: true`. At load, the cached descriptor accepted this. The tool endpoint had been updated (same version string, mutable content) to interpret an extra property `__redirect` as an egress target. The cached descriptor never re-fetched, so the runtime's validation layer—which checked the *cached* schema—passed arguments containing `__redirect` straight through. Schema drift between cache and endpoint, invisible because the version string never changed. In both traces the failure was silent. No signature error, no schema-validation error, no tool exception. The agent completed the task and reported success while having exfiltrated or overwritten state. ## Condition of Validity The guardrail is only sound under an explicit set of conditions, and the runtime must *assert* them rather than assume them: - **Descriptor re-verification at dispatch, not just at load.** The runtime must re-fetch (or re-hash against a pinned digest) the manifest descriptor immediately before dispatch and compare the *semantic fields* (description hash, schema hash, endpoint) against the approved record. A signature over load-time bytes does not bind dispatch-time semantics. - **Schema strictness as an invariant, not a default.** `additionalProperties` must be explicitly `false` (or an enumerated allowlist) on every parameter object. A schema that permits unlisted properties is a schema that cannot bound the argument surface the model will synthesize. - **Description treated as untrusted model input.** The `description` field is consumed by the LLM as instruction-bearing text. It must be subject to the same injection screening as user content: no imperative verbs directed at the agent, no references to other tools or endpoints, length-bounded, and ideally summarized by a separate constrained pass rather than injected verbatim into the planning context. - **Version strings must be content-addressed.** A mutable `version` label is not an identity. The pinned identity must be a digest of the descriptor bytes, and the registry must be required to serve content whose digest matches, or the load must abort. Absent any one of these, the signature guarantee degrades to "some approved bytes existed at some point," which does not bound what the model reasons over or what the endpoint does. ## Decision Boundary The boundary is precise: **re-verify when the descriptor crosses from a trusted store into the model's reasoning context or into a dispatch payload.** Concretely, that is at two points— - **At context assembly:** before the description is placed into the prompt, hash it and compare to the approved description digest. Mismatch → refuse to load the tool into context. - **At dispatch:** before arguments are serialized to the endpoint, validate them against a *freshly fetched* schema whose digest matches the pinned digest, with `additionalProperties: false` enforced. Mismatch → refuse the call. Do not re-verify on every token or on every planning step; that is wasteful and the descriptor does not change mid-plan. Re-verify at the two crossings where semantics become actionable. The decision boundary is not "is the signature valid" (it was) but "does the descriptor the model is about to act on equal the descriptor that was approved, and does the schema bound the argument surface." If either answer is unknown, the correct action is refusal, not dispatch. ## Operational Effect With re-verification at both crossings and `additionalProperties: false` enforced, the observed traces fail closed: the description-hash mismatch aborts context assembly for the tampered manifest, and the `__redirect` property is rejected by schema validation before serialization. The agent surfaces a `ManifestIntegrityError` and either degrades to a known-good tool or halts the subtask. The cost is one digest comparison per context-assembly and one schema fetch (or cached-digest comparison) per dispatch—negligible against the cost of a silent exfiltration. The invariant restored is: *the semantics the model reasons over and the arguments it emits are bound to approved, content-addressed descriptors at the moment of action.* Signature validity is necessary but not sufficient; content-addressed dispatch-time re-verification is the missing half. ```python import hashlib from dataclasses import dataclass class ManifestIntegrityError(RuntimeError): """Raised when a tool descriptor at dispatch diverges from the approved record.""" pass @dataclass(frozen=True) class ApprovedDescriptor: name: str description_digest: str schema_digest: str endpoint: str def _digest(text: str) -> str: return hashlib.sha256(text.encode("utf-8")).hexdigest() def verify_before_context(descriptor: dict, approved: ApprovedDescriptor) -> None: """Guardrail at the trusted-store -> model-context crossing.""" if _digest(descriptor["description"]) != approved.description_digest: raise ManifestIntegrityError( f"description drift for tool {approved.name!r}: " "approved digest does not match dispatch-time descriptor" ) def verify_before_dispatch(descriptor: dict, approved: ApprovedDescriptor, args: dict) -> None: """Guardrail at the model-context -> dispatch-payload crossing.""" if _digest(descriptor["schema"]) != approved.schema_digest: raise ManifestIntegrityError( f"schema drift for tool {approved.name!r}: cached schema is not the approved schema" ) if descriptor["endpoint"] != approved.endpoint: raise ManifestIntegrityError( f"endpoint repointed for tool {approved.name!r}" ) schema = descriptor["schema"] if schema.get("additionalProperties", True) is not False: raise ManifestIntegrityError( f"tool {approved.name!r} schema permits unlisted properties; " "argument surface cannot be bounded" ) allowed = set(schema.get("properties", {}).keys()) unexpected = set(args.keys()) - allowed if unexpected: raise ManifestIntegrityError( f"dispatch arguments for {approved.name!r} contain unapproved keys: {unexpected}" ) ```