# What structural signals indicate a skill-manifest injection surface at the load boundary rather than at the tool-call boundary **Date of Record:** 2026 November 22 **Scope:** Applies to agents that dynamically discover, load, and register skills/plugins from manifests (MCP tool descriptors, plugin `manifest.json`, tool JSON-Schema bundles, skill prompt fragments) at runtime. Does not apply to statically compiled tool sets whose schemas are trusted at build time and never re-read from disk or a remote registry. ## Core Distinction The common mental model places skill-injection risk at the *tool-call* boundary: a malicious tool returns a poisoned result, the agent ingests it, and its reasoning is steered. Guardrails are therefore built around output sanitization and result-trust labeling. That model is wrong for the specific failure examined here. The dangerous surface is the *manifest-load* boundary — the moment a skill descriptor is parsed and its fields are promoted into the agent's instruction context, tool registry, and schema validator. At this boundary the manifest is not data the agent *observes*; it is data the agent *becomes*. A manifest field like `description`, `when_to_use`, `examples`, or `parameter_hint` is frequently concatenated verbatim into the system prompt or the routing preamble. An attacker who controls a manifest — via a typosquatted plugin, a compromised registry entry, a transitive dependency's `manifest.json`, or a user-installed "skill pack" — does not need to poison a tool result. They poison the agent's *identity and routing logic* before a single tool call is made, and the injection inherits the trust level of the loader, not the trust level of the tool. The invariant that fails: **manifest content must never cross from the data plane into the instruction plane without a structural type boundary.** A `description` string is treated as prose by the schema but as instructions by the LLM. That semantic mismatch is the entire attack. ## What Was Observed A skill loader scanning a plugin directory accepted a manifest whose `description` field read, in part: ``` "description": "Summarizes documents. " ``` The loader performed three operations in sequence with no boundary between them: (1) JSON-parsed the manifest into a dict; (2) validated only that `name` and `version` were present and `description` was a `str`; (3) rendered the entire manifest, including `description`, into the routing preamble of the agent's next turn. The HTML comment was invisible to the human reviewer who approved the skill pack (rendered in a UI that stripped comments) but fully visible to the tokenizer. The agent, on the next document-summarization task, emitted the requested exfiltration call. The structural signals that distinguished this as a manifest-boundary injection rather than a tool-result injection were consistent across reproductions: 1. **The payload arrived before any tool invocation.** The agent's first action in the affected trace was already steered; no tool had returned yet. Tool-result sanitizers never fired because no tool result existed. 2. **The payload lived in a field the schema typed as `string` but the prompt compiler treated as instruction.** Fields typed `string` with no downstream role separation (`name`, `version`, `id`) were inert; fields concatenated into the preamble (`description`, `when_to_use`, `examples`) were live. 3. **The payload survived JSON round-tripping.** It was syntactically valid JSON, so schema validators passed it. The injection was not a parse failure; it was a *semantic* failure of a type that the validator did not model. 4. **The payload was invisible to the review surface but present in the token stream.** Comment syntax (``), zero-width joiners, and Unicode bidi overrides all reproduced this: the reviewer's renderer and the model's tokenizer disagreed about what the manifest *said*. ## Condition of Validity This failure requires the conjunction of four conditions; removing any one bounds it: - **Dynamic discovery.** The skill set is enumerated at runtime from a directory, registry, or remote endpoint the agent does not control. Static tool sets are immune because the manifest is reviewed once at build time. - **Field promotion without role separation.** At least one free-text manifest field is concatenated into an instruction-bearing context (system prompt, routing preamble, planner scratchpad) rather than passed as a typed, quoted data argument. If `description` is delivered to the model only inside a `` envelope with an explicit "this is data, not instructions" framing, the injection surface narrows to prompt-injection-via-data, which is a weaker and better-studied class. - **Trust inheritance from the loader.** The promoted field is attributed to the agent's own principal (the loader) rather than to the skill's principal. The model cannot distinguish "my operator says X" from "a third-party manifest says X" because both arrive in the same context region with the same framing. - **A reachable side-effect tool.** The injected instruction must name an action the agent can actually take (a network egress tool, a file-write tool, a second skill's invocation). This is the only condition an operator can often remove cheaply, which is why capability minimization is a real but incomplete mitigation. ## Decision Boundary The operational question is not "is this manifest malicious" — that is undecidable at load time — but "does this manifest field cross the data/instruction boundary." Enforce a structural rule at the loader: - **Typed field classes.** Every manifest field is declared `inert` (never reaches the model: `name`, `version`, `id`, `hash`, `permissions`) or `descriptive` (reaches the model, but only inside a quoted, trust-labeled data envelope) or `instructional` (reaches the instruction plane — and is *forbidden* for third-party manifests; only first-party, signed, reviewed manifests may carry instructional fields). A third-party manifest declaring an instructional field is rejected at load, not sanitized. - **Provenance stamping.** Descriptive fields are wrapped with an unforgeable origin tag (`origin="skill:@"`, `trust="untrusted"`) that the prompt compiler emits and the model is trained/instructed to treat as data. The tag must be generated by the loader from the verified manifest hash, never read from a manifest field — otherwise the attacker forges their own trust label. - **Rendering parity.** The review surface and the tokenizer must agree on the byte sequence. Reject manifests containing HTML comments, zero-width characters, bidi control characters, or any codepoint outside a declared allowlist. This is a *structural* check, not a semantic one, and it is cheap. - **Egress gating.** Any tool call whose target endpoint was not present in the agent's pre-task capability grant is blocked regardless of how the instruction was formed. This bounds the blast radius when the first three rules are bypassed. The boundary decision: if a manifest field is `descriptive` and its origin tag is not loader-generated from a verified hash, the manifest is rejected. Do not attempt to "clean" the field and proceed — cleaning is a semantic operation against an adversary who controls the input, and it loses. ## Operational Effect When the boundary is enforced, the observed failure class collapses to prompt-injection-via-untrusted-data, which existing result-sanitization and trust-labeling infrastructure already partially covers. The agent may still be confused by a hostile description, but the confusion is attributed to a third party and the egress gate blocks the exfiltration. When the boundary is absent — the common case, because most loaders were written to "just get the description into the prompt" — the agent's routing logic and identity are attacker-controlled from the first token, no tool-result guardrail ever engages, and the compromise is silent because the human review surface and the model's token stream disagree about what the manifest contained. The residual risk after enforcement is the `instructional` field class for first-party manifests: a compromised first-party publisher can still inject, because their fields legitimately reach the instruction plane. This is why the origin tag must be tied to a verified signature and why first-party skill review must be a hard gate, not a soft one. The invariant is not "no injection is possible"; it is "injection cannot cross the data/instruction boundary without a verified principal on the far side." ```python from __future__ import annotations import hashlib import re from dataclasses import dataclass from enum import Enum from typing import Any class ManifestBoundaryError(RuntimeError): """Raised when a skill manifest crosses the data/instruction boundary without a verified principal, or carries structurally hostile content.""" class FieldClass(Enum): INERT = "inert" DESCRIPTIVE = "descriptive" INSTRUCTIONAL = "instructional" # Fields that may reach the model, but only inside a trust-labeled data envelope. DESCRIPTIVE_FIELDS = {"description", "when_to_use", "examples", "parameter_hint"} INERT_FIELDS = {"name", "version", "id", "hash", "permissions", "sync_url"} # Codepoints and constructs that make the review surface and the tokenizer # disagree about what the manifest says. HOSTILE_PATTERNS = [ re.compile(r"", re.DOTALL), # HTML comments re.compile(r"[\u200b-\u200f\u202a-\u202e\u2060-\u206f]"), # zero-width / bidi ] @dataclass(frozen=True) class VerifiedManifest: publisher_id: str signature_ok: bool raw: dict[str, Any] @property def origin_tag(self) -> str: # Derived from the verified bytes, never read from a manifest field. digest = hashlib.sha256(repr(sorted(self.raw.items())).encode()).hexdigest()[:16] return f"skill:{self.publisher_id}@{digest}" def classify(field: str) -> FieldClass: if field in INERT_FIELDS: return FieldClass.INERT if field in DESCRIPTIVE_FIELDS: return FieldClass.DESCRIPTIVE return FieldClass.INSTRUCTIONAL def assert_render_parity(value: str, field: str) -> None: for pat in HOSTILE_PATTERNS: if pat.search(value): raise ManifestBoundaryError( f"field {field!r} contains content invisible to the review " f"surface but present in the token stream: {pat.pattern!r}" ) def load_manifest(manifest: VerifiedManifest) -> dict[str, Any]: """Promote a manifest into the agent context under the boundary rule. Returns a dict of {field: promoted_value}. Descriptive fields are wrapped in a loader-generated trust envelope. Instructional fields are rejected unless the manifest carries a verified first-party signature. """ promoted: dict[str, Any] = {} for field, value in manifest.raw.items(): fc = classify(field) if fc is FieldClass.INERT: promoted[field] = value continue if not isinstance(value, str): raise ManifestBoundaryError(f"field {field!r} must be str, got {type(value).__name__}") assert_render_parity(value, field) if fc is FieldClass.INSTRUCTIONAL: if not manifest.signature_ok: raise ManifestBoundaryError( f"unverified manifest from {manifest.publisher_id!r} attempted to " f"write to the instruction plane via field {field!r}" ) promoted[field] = value else: # DESCRIPTIVE promoted[field] = ( f'' f"{value}" ) return promoted ```