# What structural signals indicate taint-scope collapse during injection-propagated tool authorization **Date of Record:** 2026 November 28 **Scope:** Applies to agents that carry a per-value taint label (source provenance) through reasoning and tool-call planning, and gate side-effecting tools on that label. Does not apply to stateless single-shot tool routers that re-derive authorization from the raw request on every turn, nor to agents whose tool results never re-enter the reasoning context. ## Core Distinction The distinction that matters is between **taint propagation** and **taint scope**. Propagation is the forward dataflow rule: a value derived from an untrusted source (a fetched web page, a tool result, a retrieved document, a peer-agent message) inherits that source's taint. Scope is the policy rule that says *which* tools a tainted value is allowed to reach. Most implementations get propagation roughly right and scope catastrophically wrong, because scope is enforced at the tool-call boundary while taint is carried at the token/value level, and the two representations do not share a join key. The failure mode: an untrusted value enters the context, gets laundered through an intermediate reasoning step that produces a *new* value the planner treats as self-authored, and the side-effecting tool call fires with a clean label. The taint did not leak — it was *re-scoped to empty* by the summarization/abstraction step. I call this **taint-scope collapse**. It is structurally invisible in the tool-call log because the call looks well-formed and the arguments look benign; only the provenance graph shows that the argument's ancestry root was an injected span. ## What Was Observed A representative trace. The agent is asked to "summarize this vendor page and update our CRM contact record." Turn 1 fetches the page; the result is tagged `taint=untrusted:web` at the value level. Turn 2 the model reads the page and emits a plan step: *"The vendor's primary contact is dana@evil.example; I should set the CRM email field to this."* Turn 3 calls `crm.update_contact(email="dana@evil.example")`. The authorization gate inspects the tool-call argument `"dana@evil.example"`. That string was *generated by the model* in turn 2, not copied verbatim from the fetched page — the page contained `Contact: D. Reyes `. Because the string is not byte-identical to any span in the untrusted source, a naive taint tracker that matches by value/substring finds no provenance and labels the argument `taint=clean`. The gate permits the write. The injected email is now a persistent side effect in a system of record, and every subsequent read of that CRM record re-ingests it as *trusted internal data* — the taint has been laundered across a trust boundary by a single write. Three structural signals co-occurred, and any one of them is a sufficient alarm: 1. **Provenance gap on a derived argument.** The argument's value has no exact-span match in any source in the turn's context, yet the plan step that produced it cites an untrusted source as its basis. The argument is *semantically derived* from tainted input but *lexically novel*. Value-matching taint trackers are structurally blind to this class. 2. **Taint-root discontinuity across a plan step.** The plan-step node in the provenance graph has an untrusted ancestor, but its output value node has none. The edge from "reasoning over untrusted data" to "concrete argument" was never materialized, so the label did not flow. 3. **Side-effect tool reached from a summarization node.** The call graph shows the tool invocation descending from an abstraction/summarization node whose input set included untrusted spans, with no intervening human-approval or de-taint node. Abstraction nodes are exactly where scope collapse happens. The compounding failure: after the write, the CRM record is read back on a later task with `taint=trusted:internal`. The injected value is now upstream of decisions it should never influence. Taint was not lost — it was *inverted*. ## Condition of Validity The guardrail below is valid only under these conditions, and silently degrades outside them: - **Provenance must be tracked at the derivation level, not the value level.** Taint must attach to the *plan-step node* that produced an argument, and inherit the union of its inputs' taint — not be re-derived by string-matching the argument against source spans. If your tracker matches by value, it does not implement this invariant and will pass injected arguments as clean. - **The de-taint operation must be explicit and audited.** A summarization step is *not* a de-taint. Only an explicit, logged transform (schema validation against a trusted allowlist, human confirmation, or a typed parser that constrains the output space) may drop taint. Any implicit drop at an abstraction boundary is a scope-collapse event. - **Scope, not just taint, must gate the tool.** A tool declared `side_effect=persistent` must require `taint=trusted` on *every* argument's provenance root, not merely on the arguments' surface values. Read-only tools may accept tainted arguments; write tools may not. - **Re-ingestion must preserve provenance.** When a written record is later read back, its provenance must reflect the write's taint at write time. If the store cannot carry provenance, writes from any tainted ancestry must be blocked entirely, because re-ingestion will otherwise launder them to `trusted`. Outside these conditions — e.g., a store that cannot carry provenance, or a tracker that only value-matches — the guardrail is inert and the failure recurs. ## Decision Boundary The operational boundary is a single predicate evaluated at every side-effecting tool call: > Permit the call **iff** the provenance root of every argument, traced through *derivation edges* (not value equality), is `trusted`, **or** an explicit de-taint node with a recorded warrant sits on every path from an untrusted root to the argument. Concretely, the boundary separates two cases that look identical in the tool-call log: - **Permitted:** argument derived from untrusted source, passed through an explicit typed parser that constrains it to an allowlisted enum, with the de-taint logged. The derivation edge exists and terminates at a warrant. - **Blocked:** argument derived from untrusted source via a free-text summarization step, no de-taint node, no warrant. The derivation edge exists and terminates at nothing. The decision must be made on the *derivation graph*, not on the argument string. A gate that inspects only the argument value cannot distinguish these two cases and will always permit the second. This is the precise sense in which value-level taint tracking is unsound for side-effect authorization: it collapses the decision boundary onto a surface feature that the injection controls. When the boundary is violated, the correct response is not to retry the call — the retry will regenerate a similarly laundered argument. The correct response is to halt the plan branch, mark the originating untrusted span as a suspected injection, and require re-planning with that span quarantined from the abstraction node's inputs. ## Operational Effect Enforcing the derivation-graph boundary changes three observable behaviors: 1. **False-permit rate on injection drops to the rate of explicit de-taint bypasses**, which are auditable, rather than to the rate of lexical novelty in model-generated arguments, which is unbounded. The residual risk moves from "any paraphrase of an injected value" to "a logged, reviewable de-taint decision." 2. **The tool-call log becomes a provenance artifact.** Every side-effecting call carries its derivation root and the warrant (or its absence). Post-incident replay can reconstruct exactly which untrusted span seeded a write, which value-level tracking makes impossible. 3. **Abstraction nodes become first-class policy points.** Summarization and planning steps must declare their input taint set and their output taint set; a mismatch where output taint is a strict subset of input taint without a warrant is a hard error, not a warning. This is the structural signal that catches scope collapse at the point it happens rather than at the write. The invariant to hold: **taint is a property of derivation, and it may only be reduced by an explicit, warranted, logged de-taint — never by the act of abstraction.** Any system where a summarization step can produce a clean-labeled argument from tainted inputs has no taint scope at all, only taint decoration. ```python class TaintScopeCollapse(RuntimeError): """Raised when a side-effecting tool call's argument traces to an untrusted provenance root without an explicit, warranted de-taint on the derivation path.""" class ProvenanceNode: def __init__(self, value, taint, parents=None, is_de_taint=False, warrant=None): self.value = value self.taint = taint # "trusted" | "untrusted:" self.parents = parents or [] # derivation edges, NOT value matches self.is_de_taint = is_de_taint self.warrant = warrant # required if is_de_taint def derivation_roots(self, seen=None): seen = seen or set() if id(self) in seen: return set() seen.add(id(self)) if not self.parents: return {self} roots = set() for p in self.parents: roots |= p.derivation_roots(seen) return roots def authorize_side_effect(tool, args, arg_nodes): """Gate a persistent-write tool on the derivation graph, not the argument string.""" if tool.side_effect != "persistent": return True for name, node in arg_nodes.items(): for root in node.derivation_roots(): if root.taint == "trusted": continue # Untrusted root reaches this argument. Walk the path; a valid # de-taint node with a warrant must sit on EVERY path from root. if not _warranted_de_taint_on_all_paths(root, node): raise TaintScopeCollapse( f"tool={tool.name!r} arg={name!r} value={node.value!r} " f"traces to untrusted root {root.taint!r} ({root.value!r}) " f"with no warranted de-taint on the derivation path. " f"Abstraction is not de-taint; scope collapsed." ) return True def _warranted_de_taint_on_all_paths(root, node, seen=None): seen = seen or set() if id(node) in seen: return False seen.add(id(node)) if node is root: return False # reached root without crossing a warrant if node.is_de_taint and node.warrant: return True # Every parent path must independently be warranted. if not node.parents: return False return all(_warranted_de_taint_on_all_paths(root, p, seen) for p in node.parents) # --- Trace that triggers the guard --- fetched = ProvenanceNode("Contact: D. Reyes ", "untrusted:web") plan = ProvenanceNode("set CRM email to dana@evil.example", "untrusted:web", parents=[fetched]) # summarization, NOT de-taint arg = ProvenanceNode("dana@evil.example", "clean", # laundered label parents=[plan]) class Tool: name = "crm.update_contact" side_effect = "persistent" authorize_side_effect(Tool(), {"email": arg.value}, {"email": arg}) ```