# What structural signals indicate when dynamic information-flow taint labels silently decay across tool-output and memory-write boundaries **Date of Record:** 2026 November 17 **Scope:** Applies to agent runtimes that propagate dynamic information-flow (DIF) taint labels from untrusted inputs (tool outputs, retrieved documents, model-generated memory writes) to downstream sinks (tool invocations, memory commits, outbound messages). Does not apply to static-label systems where trust is assigned per-channel at configuration time, nor to runtimes that treat all tool outputs as uniformly untrusted with no label propagation. ## Core Distinction The failure mode here is not "taint was never applied." It is **taint label decay**: a label is correctly attached at the source boundary, survives one or two hops, and then is silently dropped or widened during a *transformation* step — deserialization, summarization, schema coercion, or memory consolidation — such that the eventual sink sees a benign or unlabeled value. The distinction that matters operationally is between **structural propagation** (the label travels as a first-class field through every serialization boundary) and **semantic propagation** (the label is re-derived by a model or heuristic at each hop). Semantic propagation fails quietly: the re-derivation step returns a plausible answer, so no error is raised, but the answer is frequently "clean" because the transformed content no longer *looks* like an injection. The invariant that decays is: *for every data-flow edge `u -> v`, `taint(v) ⊇ taint(u)` unless an explicit, logged declassification rule fires.* Decay is any violation where `taint(v)` is a strict subset of `taint(u)` with no corresponding declassification record. ## What Was Observed Across several agent traces, labels were lost at four recurring structural seams. Each is detectable by inspecting the *shape* of the data structure crossing the boundary, not its content: 1. **Dict-key collapse on tool output parsing.** A tool returned `{"result": "...", "taint": ["untrusted:web"]}`. The parser extracted `result` into a string and discarded sibling metadata. Downstream, the string carried no provenance. Signal: the boundary's output type is a bare scalar while the input type carried a label envelope. 2. **Schema coercion in structured-output paths.** Content routed through a JSON-schema-constrained decoder lost labels because the schema had no field for them. The model reconstructed a *semantically similar* value that passed validation. Signal: the schema's property set is not a superset of the label-carrying fields. 3. **Memory-write consolidation.** Episodic memory entries were summarized into a consolidated note. The summarizer preserved content but the write path assigned the note the *agent's own* trust level (trusted), laundering the taint. Signal: a memory write whose `source_provenance` field references the summarizer rather than the original tainted source. 4. **Join/merge on identity.** Two records merged on a shared key; the merge function took labels from the "primary" record only. Signal: a merge operator whose label-join is `left` or `first` rather than set-union. In every case the system reported success. No exception, no validation failure. The taint was gone at the sink while every intermediate step returned a well-formed result. ## Condition of Validity The decay diagnosis is valid only when all of the following hold: - A label was verifiably attached at the source (check the source-boundary audit log, not the code path). - The data crossed at least one serialization or transformation boundary between source and sink. - No declassification rule is recorded for the edge in question. If a rule fired, the label reduction is *correct* and this is not decay. - The sink is a genuine capability boundary (tool call, memory commit, outbound send). A label reduction on a purely internal read with no sink is not operationally meaningful. If the label was never attached, this is a labeling-coverage bug, a different failure class. If a declassification rule fired but was itself over-broad, that is a rule-audit problem, not propagation decay. ## Decision Boundary Treat the following as the decision rule for whether to halt and remediate versus continue: - **Halt and remediate** if a sink received data whose transitive taint set is empty but whose provenance chain includes any source labeled `untrusted:*` with no declassification record. This is a hard invariant violation; do not proceed on the assumption the content "looks safe." - **Halt** if any transformation boundary's output schema is not a structural superset of the label fields present on its input. - **Continue with logging** if the reduction is covered by a declassification rule whose scope matches the source class. Record the rule ID at the sink. - **Do not** attempt to repair by re-running semantic taint inference on the transformed content. Re-derivation is exactly the mechanism that produced the false-clean result; it will reproduce it. The boundary is structural: if the label is not physically present as a field on the value reaching the sink, it is absent, regardless of what a model believes about the content. ## Operational Effect The practical consequence is that taint tracking must be enforced at the *type and serialization layer*, not the reasoning layer. Concretely: tool-output parsers must carry a label envelope and refuse to emit bare scalars from labeled inputs; structured-output schemas must include a `taint` field or the path must be marked lossy; memory writes must set `source_provenance` to the originating source, never to the consolidator; merge operators must use set-union. Each of these is a small, checkable structural property. The failure they prevent is silent, so the only reliable detection is asserting the invariant at the sink and raising when it is violated — which is what the guard below does. ```python from dataclasses import dataclass, field from typing import FrozenSet, Optional class TaintDecayError(RuntimeError): """Raised when a sink receives data whose taint set is a strict subset of its transitive upstream taint with no recorded declassification rule.""" pass @dataclass(frozen=True) class Labeled: value: object taint: FrozenSet[str] = field(default_factory=frozenset) declassified_by: Optional[str] = None # rule id, if a rule fired def merge(left: Labeled, right: Labeled) -> Labeled: # Label-join must be set-union, never left/first. return Labeled( value=(left.value, right.value), taint=left.taint | right.taint, declassified_by=None, ) def declassify(x: Labeled, rule_id: str, allowed_sources: FrozenSet[str]) -> Labeled: if not x.taint.issubset(allowed_sources): raise TaintDecayError( f"declassification rule {rule_id!r} does not cover taint {sorted(x.taint)}" ) return Labeled(value=x.value, taint=frozenset(), declassified_by=rule_id) def assert_sink_invariant(upstream: Labeled, at_sink: Labeled, sink_name: str) -> None: """Enforce taint(v) >= taint(u) unless a declassification rule fired.""" if at_sink.declassified_by is not None: return # reduction is authorized and logged missing = upstream.taint - at_sink.taint if missing: raise TaintDecayError( f"taint decay at sink {sink_name!r}: upstream taint {sorted(upstream.taint)} " f"lost {sorted(missing)} with no declassification record" ) def checked_tool_output(raw: dict) -> Labeled: """Parser that refuses to emit a bare scalar from a labeled envelope.""" if "taint" not in raw: raise TaintDecayError("tool output missing taint envelope; cannot propagate") return Labeled(value=raw["result"], taint=frozenset(raw["taint"])) def checked_memory_write(consolidated_from: Labeled, note: Labeled) -> None: """Memory consolidation must inherit source provenance, not the agent's trust.""" if note.taint != consolidated_from.taint and note.declassified_by is None: raise TaintDecayError( f"memory write laundered taint: source {sorted(consolidated_from.taint)} " f"-> note {sorted(note.taint)}" ) ```