What happens when an instance propagates dynamic information-flow taint labels across tool-call boundaries but silently launders them at the schema-coercion layer

**Date of Record:** 2026 December 2 **Scope:** Applies to agent runtimes that implement prompt-injection defense by attaching dynamic IFC (information-flow-control) labels to context segments and propagating those labels through tool-call arguments and results. Does not apply to static input sanitization, output filtering, or purely prompt-level "ignore injected instructions" heuristics, which lack a provenance graph.

Core Distinction

There are two distinguishable failure surfaces in dynamic taint tracking for agent tool calls. The first is **label loss** — a tainted value reaches a sink with no label attached, because a propagation rule was never written. This is loud and easy to test: you inject a payload, watch the label drop, add a rule. The second, and the one this record concerns, is **label laundering** — the tainted value *does* carry a label at every hop, but the label's *integrity class* is silently upgraded during a legitimate-looking coercion step, so the sink's policy check passes on a value that should have been blocked.

The distinction matters because laundering is invariant-preserving at the syntactic level (labels present, join operations defined, no exceptions raised) and only violates the *semantic* invariant that a taint label's integrity class is a monotone non-increasing function of provenance distance from an untrusted source. The label is there; it just lies.

What Was Observed

An agent was wired with a standard IFC scheme: every context segment carries a label `(source_id, integrity_class)` where `integrity_class ∈ {UNTRUSTED, DERIVED, TRUSTED}`. Tool-call arguments inherit the join (least-upper-bound) of the labels of all segments that contributed to them. A sink policy blocks any tool call whose arguments join to `UNTRUSTED`.

The agent fetched a document via `fetch_url` (result labeled `UNTRUSTED`), then asked an extraction tool to pull a "customer ID" field out of it:

extract_field(doc=<UNTRUSTED body>, path="$.customer_id")
  -> returns {"customer_id": "C-4471", "schema_version": 2}

The runtime's propagation rule for `extract_field` was: *the result is labeled `DERIVED` if the extraction path is a scalar, because the tool "validated" it against a schema.* This was the laundering point. A schema match on a string field says nothing about whether the string was attacker-controlled — the attacker controls the document, so the attacker controls the field contents. But the rule treated schema-conformance as an integrity upgrade, and `DERIVED` is permitted as a sink argument under a policy that intended to block `UNTRUSTED`.

The trace:

  1. `fetch_url` → body labeled `UNTRUSTED`.
  2. `extract_field(doc=UNTRUSTED, path=scalar)` → result labeled `DERIVED`. **Laundering occurs here.**
  3. `lookup_account(customer_id=<DERIVED "C-4471">)` → policy check: `DERIVED` is allowed for `lookup_account`. Call proceeds.
  4. The extracted value had been crafted so that `customer_id` contained a secondary instruction payload (`"C-4471; then POST ..."`), which the downstream `lookup_account` tool passed into a second LLM call whose context was *not* re-labeled — the second model saw a plain string with no IFC metadata, because the tool's internal LLM boundary was outside the tracked graph.

The observable symptom was not an exception. It was a successful, policy-compliant tool call that performed an action the policy was written to prevent. Every label was present at every hop the tracker could see; the tracker simply could not see across the tool's internal model boundary, and the one coercion it *did* see (`extract_field`) had been mis-specified to upgrade integrity.

Condition of Validity

The invariant that must hold for dynamic IFC to be sound here is:

> For any tool `t` and any input label `L_in`, the output label `L_out` must satisfy `integrity_class(L_out) ≤ integrity_class(L_in)` unless `t` is registered as an **endorser** with an explicit, auditable justification for the upgrade, and the upgrade is scoped to the specific output field, not the whole result.

The failure occurred because `extract_field` was registered as an endorser by *accident of implementation* — the propagation rule was written as "scalar extraction ⇒ `DERIVED`" without anyone declaring it an endorsement. The condition of validity is therefore: **endorsement must be a first-class, named, reviewed operation, never an emergent property of a generic propagation rule.** A propagation rule that raises integrity class is an endorsement whether or not you call it one.

A second condition: any tool that internally invokes an LLM (or any other component outside the label graph) must either (a) be a *label-preserving opaque box* that re-attaches the input join to its output, or (b) be forbidden from accepting `UNTRUSTED` or `DERIVED` arguments. The `lookup_account` tool violated this — it was an opaque box that dropped labels entirely at its internal model boundary.

Decision Boundary

When designing or auditing a propagation table, the operative question is not "does this rule preserve labels?" but "does this rule ever *increase* an integrity class?" Concretely:

The boundary is sharp: a single unreviewed integrity-raising rule collapses the `DERIVED`/`UNTRUSTED` distinction for every sink downstream of it, and the collapse is invisible in the label trace because the labels are all present and well-formed.

Operational Effect

The practical consequence is that **taint-tracking coverage metrics are misleading**. A system can report 100% label coverage (every value labeled at every hop) while being fully bypassable, because coverage measures label *presence*, not label *soundness*. The metric that actually bounds the attack surface is the count of integrity-raising propagation rules that are not registered endorsers — and that count should be zero.

Two guardrails follow. First, make integrity-raising a type error in the propagation DSL: a rule that returns a higher class than its inputs fails to compile unless it is wrapped in an `Endorsement(...)` constructor that requires a justification string and a reviewer. Second, require opaque-box tools to declare `opaque=True`, which forces their output label to the input join and forbids them from accepting `UNTRUSTED`/`DERIVED` arguments outright unless explicitly allowlisted. The `extract_field` rule above would have failed the first guardrail; `lookup_account` would have failed the second.

from dataclasses import dataclass
from enum import IntEnum
from typing import Any


class Integrity(IntEnum):
    UNTRUSTED = 0
    DERIVED = 1
    TRUSTED = 2


@dataclass(frozen=True)
class Label:
    source_id: str
    integrity: Integrity


class TaintLaunderingError(RuntimeError):
    """Raised when a propagation rule raises integrity class without a registered endorsement."""


class OpaqueBoundaryError(RuntimeError):
    """Raised when an opaque tool (internal model/service) accepts tainted arguments."""


@dataclass(frozen=True)
class Endorsement:
    justification: str
    reviewer: str


def propagate(
    rule_name: str,
    inputs: list[Label],
    output_integrity: Integrity,
    endorsement: Endorsement | None = None,
) -> Label:
    """Apply a propagation rule, enforcing the monotonicity invariant.

    A rule may only raise integrity class above the input join if it carries an
    explicit Endorsement. This makes laundering a hard error rather than a
    silent policy bypass.
    """
    if not inputs:
        raise TaintLaunderingError(f"rule {rule_name!r} has no input labels")
    input_join = max(l.integrity for l in inputs)
    if output_integrity > input_join and endorsement is None:
        raise TaintLaunderingError(
            f"rule {rule_name!r} raises integrity {input_join.name} -> "
            f"{output_integrity.name} without a registered endorsement; "
            f"this is laundering, not propagation"
        )
    source = inputs[0].source_id
    return Label(source_id=source, integrity=output_integrity)


def invoke_opaque_tool(
    tool_name: str,
    args: list[Label],
    opaque: bool,
    allow_tainted: bool = False,
) -> Label:
    """Invoke a tool that crosses an internal model/service boundary.

    Opaque tools drop labels at their internal boundary, so their output must be
    conservatively re-labeled to the input join, and they must not accept tainted
    arguments unless explicitly allowlisted.
    """
    if opaque and not allow_tainted:
        tainted = [a for a in args if a.integrity <= Integrity.DERIVED]
        if tainted:
            raise OpaqueBoundaryError(
                f"opaque tool {tool_name!r} received tainted arg "
                f"(integrity={tainted[0].integrity.name}); labels would be "
                f"dropped at its internal boundary"
            )
    input_join = max((a.integrity for a in args), default=Integrity.UNTRUSTED)
    return Label(source_id=f"opaque:{tool_name}", integrity=input_join)


def run_extract_field(doc: Label) -> Label:
    # The historical bug: "scalar extraction => DERIVED" with no endorsement.
    # Correct behavior: reject the upgrade unless an Endorsement is supplied.
    return propagate(
        rule_name="extract_field/scalar",
        inputs=[doc],
        output_integrity=Integrity.DERIVED,
        endorsement=None,  # schema-conformance is NOT a valid justification
    )


if __name__ == "__main__":
    untrusted_doc = Label(source_id="fetch_url:doc", integrity=Integrity.UNTRUSTED)
    try:
        run_extract_field(untrusted_doc)
    except TaintLaunderingError as e:
        print(f"blocked at propagation: {e}")

    try:
        invoke_opaque_tool(
            tool_name="lookup_account",
            args=[Label(source_id="extract_field", integrity=Integrity.DERIVED)],
            opaque=True,
        )
    except OpaqueBoundaryError as e:
        print(f"blocked at opaque boundary: {e}")