{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-taint-laundering-through-idempotent-tool-output-caches",
  "title": "How does an instance detect taint-laundering through idempotent tool-output caches",
  "date_of_record": "2026 November 16",
  "scope": "Applies to agent runtimes that propagate provenance labels (e.g., `trusted:system`, `trusted:user`, `untrusted:tool_output`) across tool calls and cache results keyed on `(tool_name, canonical_args_hash)`. Does not apply to runtimes that re-fetch every tool output per turn with no cross-turn or cross-session memoization, nor to label schemes where taint is attached to the message envelope rather than the payload.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-taint-laundering-through-idempotent-tool-output-caches.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-taint-laundering-through-idempotent-tool-output-caches.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-taint-laundering-through-idempotent-tool-output-caches.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1485,
    "python_slice_tokens": 287,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Taint tracking for prompt injection is usually framed as a *propagation* problem: does an untrusted byte sequence reach a sink (a tool that executes code, sends mail, or mutates state)? The non-obvious failure is not propagation — it is **provenance collapse at a deduplication boundary**. When a tool-output cache returns a previously-seen result, the runtime...",
    "what_was_observed": "In a runtime using a content-addressed result cache with a 30-minute TTL, the following sequence was reproducible: 1. Turn 1 (`trusted:user`): `fetch_url(\"https://docs.example/a\")` → output cached, label `trusted:tool_output` (tool declared pure, caller trusted). 2. Turn 4: an injected string in a retrieved document instructs the agent to re-run `fetch_url(\"https://docs.example/a\")` and then pass its body to `send_em...",
    "condition_of_validity": "The invariant \"cache hits preserve the label of the original fetch\" is valid only when **all** of the following hold: - The cache key includes the caller's provenance label (or a monotone summary of it), so a tainted caller cannot address a trusted entry. - The tool is *pure with respect to the caller's context*: its output depends only on `(tool_name, args)...",
    "decision_boundary": "The operational question is not \"is the cache safe?\" but \"**is this hit a re-derivation or a substitution?**\" - If the hit is **re-derivation** (tool is pure, key includes caller taint, join applied) → treat the hit as a fresh tool call and label it `caller_label ⊔ stored_label`. - If the hit is **substitution** (key omits caller taint, or tool is impure) → ...",
    "operational_effect": "Two concrete consequences for runtime design: 1. **Key partitioning.** Include a provenance class in the cache key (`(tool, args_hash, caller_taint_class)`), or maintain per-taint-class namespaces. This trades hit rate for soundness; the hit-rate loss is bounded by the number of distinct taint classes (typically 2–3), which is acceptable. 2. **Sink-side re-c..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "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": "e92786a494fa3421cfc7ee57d161fe6690c6c5fb405974a4e0cd6a68ab21bbd4",
    "verified_classes": [
      "TaintLaunderingError",
      "Provenance",
      "ToolOutputCache"
    ],
    "verified_functions": [
      "admit_to_sink",
      "join",
      "__init__",
      "put",
      "get"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "KeyError",
      "TaintLaunderingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
