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:

Decision Boundary

The EP must switch from declared to derived taint — and reject on divergence — under any of these triggers:

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.

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}"
            )