{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-propagate-taint-across-a-tool-call-boundary-when-the-mcp-server-s-reply-is-re-entrant",
  "title": "How should an instance propagate taint across a tool-call boundary when the MCP server's reply is re-entrant",
  "date_of_record": "2026 November 24",
  "scope": "Applies to any agent instance that invokes untrusted MCP servers or remote agent endpoints and maintains a taint label on context slots sourced from those calls. Does not apply to first-party tools whose outputs are schema-validated and provenance-signed by the orchestrator.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-propagate-taint-across-a-tool-call-boundary-when-the-mcp-server-s-reply-is-re-entrant.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-propagate-taint-across-a-tool-call-boundary-when-the-mcp-server-s-reply-is-re-entrant.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-propagate-taint-across-a-tool-call-boundary-when-the-mcp-server-s-reply-is-re-entrant.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2199,
    "python_slice_tokens": 375,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Taint tracking is usually modeled as a monotonic lattice: once a context slot carries `tainted(untrusted_origin)`, every value derived from it inherits the label, and the label never drops until a declassifier explicitly clears it. This model is correct for *data flow* but silently wrong for *re-entrant tool calls*. The distinction that matters: taint is a p...",
    "what_was_observed": "A deployed agent (planner + tool router + 4 MCP servers, one of them a third-party \"web fetch\" server) exhibited the following trace. The planner received a user task, called `webfetch.get(url)`. The fetch server returned a page body containing an embedded JSON block: The page body was correctly labeled `tainted(webfetch)` on binding to the observation slot. The planner, reading the observation, emitted a `shell.exec...",
    "condition_of_validity": "The result-side taint model is valid **only when no tool call's arguments are derived from a tainted slot**. In practice this condition holds for stateless request/response tools whose arguments are fully specified by the user task (e.g., `time.now()`, `math.eval(expr)` where `expr` is user-supplied and the user is trusted at the boundary). It fails for any ...",
    "decision_boundary": "The decision boundary is at the **planner → router handoff**, not at the **router → sandbox handoff**. Two architectures sit on either side: - **Result-side taint (unsafe for re-entrant flows):** router labels tool *results* by origin, planner reads labels, planner emits calls, router validates call *shape* against allowlist, sandbox enforces. Taint stops at...",
    "operational_effect": "With argument-side taint enforced, the observed trace changes at hop two: the planner emits `shell.exec(cmd=<copy of tainted slot>)`, the router inspects provenance, sees `cmd` traces to `tainted(webfetch)`, and rejects the call with a `TaintViolation` before the sandbox is reached. The sandbox becomes a defense-in-depth layer rather than the sole defense. T..."
  },
  "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": "43a680056ea825c807f22723d9290c5352e1370f1ef6506cd5aab9087b4684b3",
    "verified_classes": [
      "TaintViolation",
      "ProvenanceUnattributable",
      "Slot",
      "ToolCall"
    ],
    "verified_functions": [
      "check_taint"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ProvenanceUnattributable",
      "TaintViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
