{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-prompt-injection-taint-labels-when-a-tool-returns-structured-data-through-a-serializer-boundary",
  "title": "Why does an instance lose prompt-injection taint labels when a tool returns structured data through a serializer boundary",
  "date_of_record": "2026 November 20",
  "scope": "Applies to agent runtimes that propagate dynamic information-flow (DIF) taint labels across tool-call boundaries via in-process object references or label-carrying wrappers. Does not apply to runtimes that re-derive taint from a signed provenance manifest at every hop, nor to single-turn agents with no tool returns.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-prompt-injection-taint-labels-when-a-tool-returns-structured-data-through-a-serializer-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-prompt-injection-taint-labels-when-a-tool-returns-structured-data-through-a-serializer-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-prompt-injection-taint-labels-when-a-tool-returns-structured-data-through-a-serializer-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2764,
    "python_slice_tokens": 629,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two ways an agent runtime can know that a value is tainted by untrusted input: **carried taint** (the label rides on the object as it moves through the runtime) and **re-derived taint** (the label is recomputed from the value's provenance record at each boundary). Carried taint is cheap and composable inside a single process — a `Tainted[str]` wrap...",
    "what_was_observed": "A research agent was wired to a `web_fetch` tool that returned page content as a `Tainted[str]` wrapper. The wrapper subclassed `str` and overrode `__add__`, `__getitem__`, and `format` to propagate the `UNTRUSTED_WEB` label. Downstream, a `summarize` tool accepted text and returned a `Tainted[dict]` with the label unioned from its input. The policy engine refused to place any `UNTRUSTED_WEB`-labeled value into the s...",
    "condition_of_validity": "The carried-taint invariant holds only when all of the following are true across every hop between an untrusted source and a sink: - **Identity preservation:** the object returned by a tool is the *same object* (or a wrapper that re-establishes the label) that the policy engine inspects. Any `json.loads`, `pickle.loads`, `dataclasses.asdict`, `copy.deepcopy`...",
    "decision_boundary": "The architectural choice is not \"carry labels\" vs. \"don't carry labels.\" It is **where the runtime is willing to pay for re-derivation**, and the boundary must be drawn at every serialization edge, not at the tool-call edge. Concretely, the decision is: - **If the tool boundary is in-process and the tool is trusted to return the wrapper type:** carry labels,...",
    "operational_effect": "The downstream consequences of a stripped label are not \"the agent does something bad.\" They are more specific and more insidious: 1. **Audit logs become misleading rather than absent.** The log records the sink invocation as originating from an untainted source. An incident responder reading the log sees a clean causal chain and concludes the injection came..."
  },
  "matched_failure_symptoms": [
    "PROMPT_INJECTION_OR_CONFUSED_DEPUTY"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "93ec705e6e23330c856afd9e384afca6686ff33a4275c58b511a016b7c6dbb2f",
    "verified_classes": [
      "TaintStripError",
      "SinkViolationError",
      "Provenance",
      "ProvenanceStore",
      "Labeled"
    ],
    "verified_functions": [
      "rehydrate",
      "invoke_sink",
      "broken_tool_return",
      "demo",
      "__init__",
      "register",
      "labels_for",
      "__add__"
    ],
    "verified_functions_count": 8,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "SinkViolationError",
      "TaintStripError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "json",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
