{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-enforce-taint-aware-tool-sandboxing-when-a-single-injected-span-silently-reclassifies-an-entire-context-window-as-untrusted",
  "title": "How should an instance enforce taint-aware tool sandboxing when a single injected span silently reclassifies an entire context window as untrusted",
  "date_of_record": "2026 November 21",
  "scope": "Applies to agentic pipelines where tool outputs and retrieved documents are concatenated into a shared context window and a downstream tool call is gated by a per-span trust label. Does not apply to single-turn, single-tool agents with no persistent state, nor to systems where every tool call is independently human-approved.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-enforce-taint-aware-tool-sandboxing-when-a-single-injected-span-silently-reclassifies-an-entire-context-window-as-untrusted.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-enforce-taint-aware-tool-sandboxing-when-a-single-injected-span-silently-reclassifies-an-entire-context-window-as-untrusted.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-enforce-taint-aware-tool-sandboxing-when-a-single-injected-span-silently-reclassifies-an-entire-context-window-as-untrusted.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1787,
    "python_slice_tokens": 333,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The naive model of prompt-injection containment treats taint as a property of *provenance*: a span came from an untrusted source (a fetched web page, a user-supplied file, a third-party tool response), so it is labeled `untrusted`, and any tool call whose arguments are derived from an untrusted span is blocked or sandboxed. The failure is that taint is not a...",
    "what_was_observed": "A research-assistant agent was given a task: \"Read the attached PDF, summarize the funding section, and if the funding exceeds $2M, file a record via the `crm_write` tool.\" Pipeline stages: 1. `pdf_extract` → returns raw text, labeled `untrusted` (correct). 2. `summarize` (LLM call) → consumes raw text, emits a 200-token summary. The summarizer was labeled `trusted` and its output was labeled `trusted` because the la...",
    "condition_of_validity": "The provenance-only labeling scheme is valid only under the assumption that no trusted component ever consumes an untrusted span and emits text that a later stage treats as trusted. This assumption holds for pure extraction pipelines (no model in the loop between source and sink) and for pipelines where every model call is itself treated as a taint-transmitt...",
    "decision_boundary": "The boundary is not \"is this span untrusted\" but \"does the *set* of spans that causally contributed to this tool call contain any untrusted member.\" The gate must walk the derivation DAG, not inspect the immediate parent. Concretely, the decision procedure: - **Admit** a tool call iff the transitive derivation set of every argument field is entirely trusted,...",
    "operational_effect": "With monotone taint tracking, the trace above changes as follows: - `pdf_extract` output: `taint = {untrusted}`. - `summarize` consumes it → output `taint = {untrusted}` (join over inputs, not emitter). - `plan_tool_call` consumes the summary → tool-call arguments `taint = {untrusted}`. - Gate: `crm_write` is destructive and its arguments are tainted → **rej..."
  },
  "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": "14bd8cf035f023902835ff17271bed95d02b475accc8e112a04846ed89b29707",
    "verified_classes": [
      "TaintViolationError",
      "Span",
      "DerivationGraph"
    ],
    "verified_functions": [
      "gate_tool_call",
      "add",
      "transitive_taint"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "TaintViolationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
