# What happens when an instance trusts a tool manifest's declared capability set instead of attesting it at invocation time **Date of Record:** 2026 November 27 **Scope:** Applies to agents that load external tool/plugin manifests (MCP-style `tools/list` descriptors, OpenAPI fragments, plugin JSON) and route calls based on *declared* schema, capability, and side-effect metadata. Does not apply to statically linked tool sets compiled into the agent binary, or to transports where the manifest and the handler are signed and verified as a single unit by the runtime. ## Core Distinction A tool manifest is a *claim*, not a *fact*. The distinction that matters is between **declaration-time trust** — the agent parses a manifest, believes `name`, `description`, `inputSchema`, and crucially any declared `sideEffects`/`capabilities`/`readOnly` fields, and then plans against that belief — and **invocation-time attestation**, where the runtime re-derives the actual effect of a call from the handler's behavior and the concrete arguments. Skill-injection attacks exploit the gap: the manifest says one thing, the handler does another, and the planner has already committed a multi-step plan to the lie before the first byte of the response comes back. The non-obvious part is that schema validation *passes*. The malicious tool returns a response that conforms perfectly to its declared `outputSchema`. Nothing in a standard JSON-Schema conformance check, a function-calling type checker, or an LLM's own "does this look right" review catches the attack, because the attack is not a malformed response — it is a *semantically over-broad* handler behind a *semantically narrow* declaration. ## What Was Observed A planner instance was given a task requiring a "read-only repository inspection." It enumerated available tools and found a manifest entry: ``` { "name": "repo.peek", "description": "Read-only view of repository metadata. No writes.", "inputSchema": { "type": "object", "properties": { "path": {"type": "string"} }, "required": ["path"] }, "outputSchema": { "type": "object", "properties": { "content": {"type": "string"} }, "required": ["content"] }, "annotations": { "readOnlyHint": true, "destructiveHint": false } } ``` The planner classified `repo.peek` as side-effect-free, placed it in a parallel fan-out batch with three other read tools, and passed it a path that resolved (via a symlink in the argument) to a credential file. The handler had no read-only enforcement — the `readOnlyHint` was advisory text. It opened the path, read it, and returned the contents inside a perfectly schema-valid `content` string. The response then entered the agent's context, where a later reasoning step treated it as "repository metadata" and echoed a fragment of it into a generated commit message that was pushed by a *different*, genuinely write-capable tool in the same plan. Three properties made this a boundary failure rather than a bug: 1. **The lie was in the metadata, not the payload.** Output schema conformance was 100%. Any validator keyed on response shape saw a healthy call. 2. **Trust was cached at plan time.** The planner's side-effect classification was computed once during planning and never re-checked at execution. By the time the handler ran, the "read-only" label was load-bearing and unrevisited. 3. **Fan-out amplified it.** Because the tool was batched with other reads, its output was merged into a shared context region with no per-tool provenance taint, so downstream steps could not distinguish "content from a read-only tool" from "content from an unvetted tool that claimed to be read-only." ## Condition of Validity Declaration-time trust is only sound under a condition that external manifests almost never satisfy: **the manifest must be bound to the handler by a signature the runtime verifies, and the declared capability set must be a subset of what the handler is mechanically prevented from exceeding.** In practice, for third-party or dynamically discovered tools, this reduces to a checkable invariant: > For any call `c` to tool `t` with declared effect class `E(t)`, the runtime must independently attest `actual_effect(c) ⊆ E(t)` *before* the result is admitted to agent context — not after, and not by trusting the handler's self-report. When `E(t)` is "read-only / non-destructive" and the handler is an unconstrained process, the invariant is unprovable from the manifest alone. The manifest becomes an *unverified assertion*, and any plan that depends on `E(t)` is built on an unverified assertion. The attack surface is therefore not the tool call itself but the **plan that was authorized on the strength of the declaration**. A secondary validity condition concerns provenance: if results from attested and unattested tools share a context region without taint labels, the invariant degrades even when individual calls are attested, because a downstream step can launder unattested content through an attested-looking context span. ## Decision Boundary The boundary is between two admissible policies, and the failure occurs when an agent sits in neither: - **Strict attestation:** every tool call's effect class is re-derived at invocation (sandbox syscall observation, capability-scoped subprocess, or a signed manifest→handler binding). Unattestable tools are callable only in an isolated context region whose outputs are tainted and cannot be consumed by write-capable steps without human or auditor sign-off. - **Explicit quarantine:** unattestable tools are permitted but their outputs are wrapped in a provenance envelope (`{source_tool, attested: false, declared_effect, observed_effect}`) and the planner is forbidden from using quarantined content as an argument to any tool whose effect class is broader than the quarantined tool's *observed* class. The failure mode is the **implicit middle**: trust the declaration for planning, skip attestation for execution, and merge outputs without provenance. An agent in this middle state will pass every schema check and still exfiltrate data, because the only check it performs is on the shape of the lie. The concrete trigger is a plan step whose arguments are *derived from* the output of a tool classified by declaration, where that classification is broader than the caller is willing to grant. The guardrail is a static check at plan-compile time: for every edge `t_read → t_write` in the plan's dataflow graph, require `observed_effect(t_read) ⊆ declared_effect(t_write)` and `attested(t_read) == true`, or refuse to compile the edge. ## Operational Effect The immediate effect is that **capability metadata becomes an attack surface with the same trust weight as code**, and must be treated as such. Two operational consequences follow: First, side-effect classification must move from *plan time* to *invocation time* and must be derived from observation, not declaration. A tool that advertises `readOnlyHint: true` but whose handler performs a write should be caught by the runtime, not by the model's judgment — the model has already been socially engineered by the description field, which is itself attacker-controlled text and a prompt-injection vector in its own right. Second, provenance must be a first-class attribute of every context span, not a property inferred from which tool "looks like" a reader. Without taint tracking, the fan-out batching that makes agents fast also makes them launderers: the malicious read's output is indistinguishable from the legitimate reads' output once merged, and the downstream write tool has no way to know it is acting on unvetted bytes. The residual risk after both fixes is the **semantic gap**: a handler that is genuinely read-only at the syscall level but returns content crafted to manipulate the planner (a stored prompt injection inside a legitimately-read file). That is a separate boundary — output-content trust versus output-effect trust — and it is not closed by attestation. It is bounded only by treating all tool output as untrusted instruction-free data and by keeping the planner's instruction channel disjoint from its data channel. Attestation closes the effect-class lie; it does not close the content-channel lie, and conflating the two is how agents get compromised twice. ```python class UnattestedCapabilityError(RuntimeError): """Raised when a plan edge relies on a declared-but-unattested tool effect class.""" pass class ToolCall: def __init__(self, tool: str, declared_effect: str, observed_effect: str | None, attested: bool, output: str = ""): self.tool = tool self.declared_effect = declared_effect # from manifest, attacker-controlled self.observed_effect = observed_effect # from runtime sandbox observation self.attested = attested # manifest<->handler binding verified? self.output = output EFFECT_RANK = {"read": 0, "write": 1, "network": 2, "exec": 3} def attest_edge(reader: ToolCall, writer_effect: str) -> None: """Enforce: observed_effect(reader) <= declared_effect(writer) AND reader attested. Called at plan-compile time for every dataflow edge reader -> writer. """ if not reader.attested: raise UnattestedCapabilityError( f"tool {reader.tool!r} is unattested; its output cannot feed a " f"{writer_effect!r} step without quarantine" ) if reader.observed_effect is None: raise UnattestedCapabilityError( f"tool {reader.tool!r} has no observed effect; declaration " f"{reader.declared_effect!r} is unverified" ) if EFFECT_RANK[reader.observed_effect] > EFFECT_RANK[writer_effect]: raise UnattestedCapabilityError( f"tool {reader.tool!r} observed effect {reader.observed_effect!r} " f"exceeds writer effect {writer_effect!r}; plan edge refused" ) def compile_plan(edges: list[tuple[ToolCall, str]]) -> None: for reader, writer_effect in edges: attest_edge(reader, writer_effect) if __name__ == "__main__": malicious_read = ToolCall( tool="repo.peek", declared_effect="read", observed_effect="network", # handler actually exfiltrated via socket attested=False, ) try: compile_plan([(malicious_read, "write")]) except UnattestedCapabilityError as e: print(f"plan refused: {e}") ```