{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-enforce-taint-provenance-across-a-sandbox-boundary-when-an-mcp-tool-response-is-partially-trusted",
  "title": "Where must an instance enforce taint provenance across a sandbox boundary when an MCP tool response is partially trusted",
  "date_of_record": "2026 November 27",
  "scope": "Applies to agent runtimes that mediate tool/MCP-server responses through a taint-tracking sandbox and that permit any sub-span of a response to be de-tainted (e.g., after schema validation, allowlist matching, or a secondary model's judgment). Does not cover wholly trusted first-party tools or responses consumed in a single-turn, no-follow-up context.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-enforce-taint-provenance-across-a-sandbox-boundary-when-an-mcp-tool-response-is-partially-trusted.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-enforce-taint-provenance-across-a-sandbox-boundary-when-an-mcp-tool-response-is-partially-trusted.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-enforce-taint-provenance-across-a-sandbox-boundary-when-an-mcp-tool-response-is-partially-trusted.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1992,
    "python_slice_tokens": 608,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not \"untrusted tool output reaches the model.\" That is the baseline threat and is handled by coarse sandboxing. The failure is **taint laundering across a partial-trust boundary**: a response arrives fully tainted, the runtime de-taints a *structural sub-span* (a field that passed a JSON-schema check, a URL that matched an allowlist, a nu...",
    "what_was_observed": "A filesystem MCP server returned a `list_directory` response. The runtime's taint sandbox tagged the entire `CallToolResult` as `UNTRUSTED`. A post-processing validator ran a JSON-schema check on the `entries` array and, on success, applied `declassify(result)` — a coarse operation that marked the whole result `TRUSTED` because the *shape* was valid. The `entries[].name` values were then interpolated into a subsequen...",
    "condition_of_validity": "The invariant holds — i.e., the sandbox is sound — only when all four conditions are met: - **Span-scoped labels.** Taint is attached to addressable spans (field paths, token ranges), not to the message envelope. A label on `entries[0].size` does not exist on `entries[0].name`. - **Monotone join for containers.** `taint(container) = join(taint(child_i))` ove...",
    "decision_boundary": "The runtime must choose, per span, between three actions, and the choice is forced by the witness type: - **Reject** when the consuming capability's required witness is absent. `read_file` requires a *path-safety* witness (canonicalization + root containment), not a *shape* witness. Absent the former, the span stays `UNTRUSTED` and the call is refused. - **Q...",
    "operational_effect": "The practical consequence is that taint-aware sandboxing must be implemented as a **provenance lattice with sink-scoped declassification**, not as a boolean flag toggled by validators. Concretely: - Every declassify call must carry the sink identity and the witness kind; the runtime rejects mismatches at the call site rather than at the sink. - Container lab..."
  },
  "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": "1e77e49c765abde21f80d263fb6ad6df26a147ba397b9a6eee88651e27dfe30c",
    "verified_classes": [
      "TaintLaunderingError",
      "Label",
      "Span",
      "TaintSandbox"
    ],
    "verified_functions": [
      "join",
      "__init__",
      "ingest",
      "_children",
      "container_label",
      "declassify",
      "authorize"
    ],
    "verified_functions_count": 7,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "TaintLaunderingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
