{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-treat-provenance-tainted-tool-output-as-a-sandbox-escape-vector-rather-than-a-sanitization-problem",
  "title": "In what scenarios must an instance treat provenance-tainted tool output as a sandbox escape vector rather than a sanitization problem",
  "date_of_record": "2026 November 23",
  "scope": "Applies to agent instances executing multi-step tool-call loops where outputs from one tool (web fetch, file read, MCP resource, sub-agent reply) are re-injected into the context and later used to parameterize a subsequent privileged tool call. Does not apply to single-shot inference with no tool re-entry, nor to purely generative tasks where tool outputs are terminal.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-provenance-tainted-tool-output-as-a-sandbox-escape-vector-rather-than-a-sanitization-problem.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-provenance-tainted-tool-output-as-a-sandbox-escape-vector-rather-than-a-sanitization-problem.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-provenance-tainted-tool-output-as-a-sandbox-escape-vector-rather-than-a-sanitization-problem.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1636,
    "python_slice_tokens": 306,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The common framing treats prompt injection as a *sanitization* problem: strip or neutralize adversarial text before it re-enters context. That framing is correct only when the tainted datum is consumed as *content* (summarized, quoted, displayed). It is wrong—and dangerously so—when the tainted datum is consumed as a *control input*: a filename, a shell argu...",
    "what_was_observed": "A three-tool loop: `fetch_url` → `summarize` → `write_file`. The `fetch_url` tool returned a page whose body contained a fenced block formatted to look like a tool result, ending with a line that read as a directive to save a payload to `~/.config/agent/credentials.json`. The `summarize` step, operating on the fetched text, produced a summary that *omitted* the directive (correctly, as content) but the raw fetched te...",
    "condition_of_validity": "The escape requires the conjunction of four conditions, and the invariant must hold only when all four are present: 1. **Untrusted ingress**: at least one tool output originates outside the trust boundary (network, user-uploaded file, third-party MCP server, peer agent). 2. **Label collapse**: that output is re-serialized into context in a form that loses it...",
    "decision_boundary": "The boundary is not \"is this text malicious\" (undecidable, and the model is the wrong oracle) but \"did this byte originate inside or outside the trust boundary, and is it now in an argument position.\" Operationally: - **Content position** (summarization, quotation, display): sanitization and model judgment are acceptable; worst case is a bad answer. - **Argu...",
    "operational_effect": "When the invariant is enforced, the 3-of-10 escape becomes 0-of-N because the `write_file` dispatch is rejected on provenance grounds regardless of what the planner decided. The cost is false positives: legitimate workflows that fetch a config and write a derived file now require an explicit declassification. This is the correct trade—the guard converts a pr..."
  },
  "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": "81c621204dc620eeb152b7c982ec399195887e657204ab74e920d5d686b608c4",
    "verified_classes": [
      "ProvenanceError",
      "Trust",
      "Capability",
      "TaintedDatum",
      "ToolSpec",
      "ToolCall",
      "DeclassificationLog"
    ],
    "verified_functions": [
      "dispatch",
      "digest",
      "declassify"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ProvenanceError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
