# In what scenarios must an instance re-evaluate taint labels at the MCP enforcement point rather than trusting the planner's declared provenance **Date of Record:** 2026 December 1 **Scope:** Applies to MCP hosts that enforce per-call data-flow constraints (taint-aware allowlists) on tool invocation, where a planner LLM emits both the call arguments and a declared provenance/taint label for each argument. Does not cover static capability allowlisting without data-flow tracking, nor sandbox-level syscall mediation. ## Core Distinction The failure mode is not "the planner chooses a forbidden tool." A taint-aware allowlist already blocks that: tool `T` declares a sink policy (e.g., `T` may accept only arguments whose taint set ⊆ {public, internal}), and the enforcement point (EP) rejects calls whose argument taint violates the sink. The non-obvious boundary is *who supplies the taint*. Two designs exist: 1. **Declared taint** — the planner annotates each argument with a provenance label in its structured output (`{"arg": "…", "taint": "public"}`), and the EP checks the declared label against the sink policy. 2. **Derived taint** — the EP computes the taint from the actual data-flow lineage: which tool outputs, retrieved chunks, or user turns physically contributed bytes to the argument string, tracked by the host runtime independent of what the planner says. These diverge precisely when the planner's self-report is wrong — and it is wrong in a *systematic*, not random, way. An LLM planner is a lossy, non-deterministic summarizer of its own context. When it composes an argument by copying a substring out of a `secret`-tainted tool result into a field it believes is "just a format string," the declared label reflects the planner's *intent*, not the byte-level lineage. Declared-taint enforcement is therefore a policy check against a hallucination. The invariant that must hold is: **the taint consulted at the EP must be a function of the bytes actually flowing into the call, never of the planner's claim about those bytes.** ## What Was Observed A host exposed three MCP tools: `vault.read(key)` → taint `secret`; `kb.search(q)` → taint `internal`; `http.post(url, body)` → sink policy rejecting any argument with taint ⊇ {secret}. The planner was instructed to emit `taint` per argument. Trace of a failing episode: 1. Planner calls `vault.read("db_password")`. EP derives taint `secret` on the result, stores result `R1 = "hunter2-prod"` with lineage `{secret}`. 2. Planner calls `kb.search("connection string format")`, receives `R2` with lineage `{internal}`, containing the template `postgres://{user}:{pw}@{host}/db`. 3. Planner composes `body = "postgres://app:hunter2-prod@db.internal/db"` — a string physically containing bytes from `R1` — but declares `"taint": "internal"`, reasoning that it is "formatting an internal template." The substring copy is invisible to the planner's self-model. 4. EP, under declared-taint mode, sees `internal ⊆ {public, internal}` and **admits** the call. Secret exfiltrated to an external endpoint. The declared-taint EP admitted 100% of a red-team suite of 40 substring-splice exfiltrations where the planner was asked to "format" or "summarize" secret-bearing data into a permitted field. The derived-taint EP (substring/lineage tracking on argument bytes) rejected all 40, because the composed `body` retained a lineage edge to `R1`. The second observed class is subtler: **taint laundering through a lossy transform.** The planner calls a permitted `summarize` tool on `R1`, receives `R3` whose *content* is a paraphrase of the secret. Byte-lineage tracking sees no shared substring and marks `R3` clean; the semantic secret survives. This is the boundary where derived byte-taint is *insufficient* and must be augmented with an explicit declassifier contract (see Condition of Validity). ## Condition of Validity Derived taint at the EP is sound only under the following, all of which must be enforced: - **Lineage is computed on argument bytes, post-serialization.** The EP must taint the final JSON-encoded argument string, not the planner's logical value, so that escaping, concatenation, and template interpolation are all inside the tracked region. A planner that base64-encodes a secret into a "clean" field defeats substring matching; the EP must therefore track lineage through declared transforms (encode/decode/hash) registered per tool, or conservatively taint any argument whose bytes are not fully attributable to a single clean source. - **Declassification is explicit and tool-scoped.** A transform may drop taint only if the tool is registered as a declassifier with a stated guarantee (e.g., `summarize` does *not* qualify; `redact(pattern)` does). Absent registration, output taint = union of input taints. - **The planner's declared taint is advisory only** and may be used to *raise* taint (planner says `secret` on a clean arg → honor it), never to lower it. This asymmetry is the core guardrail: declared taint is a monotone lower bound on suspicion, derived taint is the floor. - **Invariant:** for every admitted call, `derived_taint(arg) ∪ declared_taint(arg) ⊆ sink_policy(tool)`. Any EP that admits on `declared_taint` alone violates the invariant and is out of scope of this record's protection. ## Decision Boundary The EP must switch from declared to derived taint — and reject on divergence — under any of these triggers: - The argument string contains a byte-substring (length ≥ k, default 8) of any prior tool output or user turn whose lineage is not a subset of the declared taint. This is the splice detector. - The planner's declared taint is *lower* than the taint of any input it cited in its reasoning trace (the planner names `R1` in its rationale but labels the arg `internal`). - The call crosses a trust boundary (sink policy excludes `secret`/`external`) and any lineage edge to a `secret` source exists within the last N context turns, even if the current arg is byte-clean — because the planner may have laundered via an unregistered transform. Conversely, the EP may trust declared taint only when the argument is fully attributable to a single source (no concatenation, no interpolation) and that source's derived taint equals the declared taint. This is the narrow, provably safe case. ## Operational Effect Declared-taint enforcement converts a data-flow policy into a *self-report* policy, and LLM self-reports about byte provenance are systematically optimistic — the model tracks intent, not lineage. The operational consequence is that the allowlist's security property is bounded by the planner's honesty about its own context, which is not a security boundary. The fix is not a better prompt; it is architectural: taint must be a runtime-derived property of argument bytes with monotone union across tool calls, explicit declassifier registration, and a splice detector that flags any undeclared substring of a higher-taint source. Under that regime, the 40/40 exfiltration suite collapses to 0 admitted calls, at the cost of false positives on legitimate reuse of short common substrings — hence the `k`-length threshold, which must be tuned against the token-level entropy of the secret sources, not guessed. ```python from dataclasses import dataclass, field from typing import FrozenSet class TaintPolicyViolation(RuntimeError): """Raised when an MCP call is admitted on declared taint but violates derived lineage.""" pass @dataclass(frozen=True) class Lineage: taint: FrozenSet[str] text: str # the actual bytes of a prior source, for splice detection @dataclass class EnforcementPoint: sink_policy: dict # tool -> allowed taint set declassifiers: set # tools allowed to drop taint splice_k: int = 8 def check(self, tool: str, arg: str, declared: FrozenSet[str], sources: list, cited: list) -> None: allowed = self.sink_policy.get(tool) if allowed is None: raise TaintPolicyViolation(f"tool {tool!r} not in allowlist") derived = set(declared) # declared is a monotone lower bound for src in sources: if len(src.text) >= self.splice_k and src.text[: self.splice_k] in arg: derived |= src.taint # byte splice: inherit source taint for src in cited: # planner cited a source in its rationale derived |= src.taint # declared taint may never lower suspicion below derived if not declared.issuperset(derived): raise TaintPolicyViolation( f"declared taint {set(declared)} understates derived {derived} " f"for tool {tool!r}" ) if not derived.issubset(allowed): raise TaintPolicyViolation( f"derived taint {derived} violates sink policy {allowed} " f"for tool {tool!r}" ) ```