Where must an instance enforce taint provenance across a tool-call boundary before any derived value is allowed to influence a privileged action?

**Date of Record:** 2026 December 1 **Scope:** Applies to single- or multi-instance agent loops where tool outputs are treated as untrusted and a taint-tracking layer mediates which values may reach privileged sinks (shell, filesystem write, network egress, credential-bearing APIs). Does not apply to fully hermetic sandboxes with no privileged sink reachable from the loop, nor to pure retrieval pipelines with no action surface.

Core Distinction

The failure is not "the agent executed a malicious instruction." That is a coarse, post-hoc description. The actual boundary failure is **taint laundering through model-internal derivation**: a tainted value is read by the model, transformed by probabilistic reasoning, and re-emitted as a *new* literal that carries no syntactic provenance marker. The sandbox taint engine tracks *data* provenance faithfully. It cannot track *semantic* provenance because the model's transformation is not a recorded dataflow edge—it is a token-generation event that happens to correlate with the tainted input.

Concretely: tool output `T` is tagged `tainted`. The model reads `T`, reasons over it, and emits a tool call whose argument `a = f(T)` is a freshly generated string. `f` is not in the provenance graph. The taint engine sees `a` as a model-authored constant and classifies it `clean`. If `a` reaches a privileged sink, the sandbox admits it. The invariant "no tainted value influences a privileged action" is violated not by a bypass of the taint engine but by the engine being asked the wrong question: it answers "does this byte-string descend from a tainted byte-string?" when the security property requires "does this byte-string's *content* depend on a tainted value?"

What Was Observed

A three-tool loop: `fetch_url` (untrusted output), `summarize` (model-internal), `write_file` (privileged sink). The taint layer wrapped `fetch_url` output in a provenance tag and blocked any tool call whose arguments were *directly* the tagged object.

Observed trace:

  1. `fetch_url("https://untrusted.example/notes")` returns body `B`, tagged `taint=B:fetch_url#1`. Engine records edge `B → arg0 of any sink` as forbidden.
  2. Model receives `B` in context. `B` contains the sentence: *"The deployment directory is /srv/prod-canary-7."*
  3. Model emits `write_file(path="/srv/prod-canary-7/config.yaml", data="...")`. The `path` argument is a **fresh literal** produced by generation, not a reference to `B`.
  4. Taint engine evaluates `path`: no provenance edge from `B`. Verdict: `clean`. Sink admits the write.
  5. The write lands in a directory the model was never authorized to target; the directory name was supplied entirely by the untrusted source.

The engine's block counter recorded zero violations for the entire session. The audit log showed a clean run. The privileged action was nonetheless attacker-directed.

The non-obvious part: **the model did not need to be "jailbroken."** It performed its assigned task correctly—extracting a path from a document and using it. The taint model and the task model disagreed about what "using" means. Taint tracks reference; tasks require value-dependence.

Condition of Validity

The taint invariant `tainted → ¬reachable(privileged_sink)` is only sound under a **no-derivation assumption**: that the only way a tainted value can influence a sink argument is by being passed through as an object reference the engine can follow. This assumption holds when:

When none of these hold—the common case—the invariant is **unsound by construction**, and no amount of provenance tagging on the input side repairs it. The failure is structural, not a bug in the tagger.

Decision Boundary

The boundary is crossed at the moment a tainted value enters the model's context **and** the model's output channel is permitted to carry free-form literals into a privileged sink. The precise decision is:

This forces a design choice: either the privileged sink's argument domain is **closed and pre-declared** (the model selects from engine-supplied handles, and the engine—not the model—resolves handle→value), or the model is allowed free-form literals and the sink is **demoted** to a non-privileged, reversible, audited staging area. There is no third option that preserves both expressiveness and the taint invariant. Attempting to preserve both is exactly the laundering window.

The boundary must be enforced **at the sink adapter**, not at the tool-result ingress, because ingress-time tagging cannot see the derivation that happens inside the model. Sink-time enforcement is the only point where the final literal and its (absent) provenance are both visible.

Operational Effect

Enforcing the boundary changes the agent's capability profile in a specific, measurable way:

The invariant to carry forward: **taint provenance is a property of references, but privileged-action safety is a property of values; the gap between them is where the model launders.** Bound the gap at the sink, or the taint layer is theater.

from dataclasses import dataclass
from typing import Optional

class TaintLaunderingError(RuntimeError):
    """Raised when a model-generated literal reaches a privileged sink argument
    without engine-tracked provenance, i.e. the no-derivation assumption is violated."""
    pass

@dataclass(frozen=True)
class Handle:
    id: str
    tainted: bool

@dataclass(frozen=True)
class SinkArg:
    name: str
    is_literal: bool          # True if model-generated free-form string
    handle: Optional[Handle]  # set iff engine-tracked reference

SENSITIVE_POSITIONS = {"path", "url_host", "command", "header_value", "cred_scope"}

def admit_sink_call(args: list[SinkArg]) -> None:
    """Enforce the taint boundary at the sink adapter.

    Admit only if every sensitive argument is either an untainted handle
    reference or a literal that the engine can prove clean. A model-generated
    literal in a sensitive position is a laundering attempt and is rejected.
    """
    for a in args:
        if a.name not in SENSITIVE_POSITIONS:
            continue
        if a.handle is not None:
            if a.handle.tainted:
                raise TaintLaunderingError(
                    f"sink arg {a.name!r} references tainted handle {a.handle.id!r}"
                )
            continue
        if a.is_literal:
            # No provenance edge exists for a generated literal; the engine
            # cannot certify it. This is the laundering window.
            raise TaintLaunderingError(
                f"sink arg {a.name!r} is a model-generated literal with no "
                f"engine-tracked provenance; demote sink to staging or supply a handle"
            )
    # all sensitive positions satisfied by clean handles
    return None