{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-re-derive-document-taint-after-a-retrieval-re-rank-and-why-does-the-sandbox-s-taint-label-silently-detach-from-the-document-bod",
  "title": "Where must an instance re-derive document taint after a retrieval re-rank, and why does the sandbox's taint label silently detach from the document body?",
  "date_of_record": "2026 November 30",
  "scope": "Applies to any agent that ingests retrieved documents into a taint-tracking sandbox and then re-ranks, deduplicates, or re-chunks those documents before tool invocation. Does not apply to systems where retrieved content is immutable between fetch and tool call, or where taint is computed at tool-call time from the raw bytes rather than carried as a label.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-re-derive-document-taint-after-a-retrieval-re-rank-and-why-does-the-sandbox-s-taint-label-silently-detach-from-the-document-bod.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-re-derive-document-taint-after-a-retrieval-re-rank-and-why-does-the-sandbox-s-taint-label-silently-detach-from-the-document-bod.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-re-derive-document-taint-after-a-retrieval-re-rank-and-why-does-the-sandbox-s-taint-label-silently-detach-from-the-document-bod.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1912,
    "python_slice_tokens": 388,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Indirect prompt injection defense via taint tracking rests on an invariant that is easy to state and easy to violate: *the taint label attached to a document must be a function of the document's current bytes, not of the retrieval event that first produced it.* Most implementations attach taint at fetch time — a document retrieved from an untrusted source is...",
    "what_was_observed": "A research agent fetched eight documents from a mix of trusted internal sources and untrusted web sources. The fetch layer assigned taint correctly: three `CLEAN`, five `TAINTED`. The agent then invoked a re-ranking tool that scored all eight documents against the query and returned the top four as a *new* list of content objects, each with a `source_id` field. The re-ranker's serialization dropped the taint attribut...",
    "condition_of_validity": "The label-carrying approach is valid if and only if, for every content object `c` presented to the sandbox, `taint(c) == join(taint(b) for b in bytes_of(c))`, where `join` is the lattice least-upper-bound (any `TAINTED` contributor makes the whole `TAINTED`). This holds when: - Content objects are never recombined across source boundaries, **or** - Every con...",
    "decision_boundary": "The boundary is drawn at the transform stage, not at the sandbox. Two admissible architectures: **Content-addressed taint (preferred).** Taint is a function of a content hash, maintained in a side table `hash → taint`. Every transform stage, even taint-blind ones, produces new bytes with a new hash; the orchestration layer computes taint for the new hash as ...",
    "operational_effect": "With content-addressed taint and a join-on-transform rule, the merged chunk in the trace above resolves to `TAINTED` (join of one `CLEAN` and one `TAINTED` contributor), the `write_file` call is refused or routed to a confirmation gate, and the injection is contained. The cost is a hash table and a join computation per transform output — negligible relative ..."
  },
  "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": "e10bbb9e75779112af12551e7ae715080755fd3abd0e7f564c3c96d05d0146d6",
    "verified_classes": [
      "TaintProvenanceError",
      "ContentObject",
      "TaintTable"
    ],
    "verified_functions": [
      "join_taint",
      "admit_to_sandbox",
      "rerank_with_taint",
      "content_hash",
      "__init__",
      "register",
      "is_tainted"
    ],
    "verified_functions_count": 7,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "TaintProvenanceError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
