{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-track-taint-through-a-tool-result-that-returns-a-reference-rather-than-a-value-and-why-does-capability-scoped-sandboxing-silent",
  "title": "How should an instance track taint through a tool result that returns a *reference* rather than a value — and why does capability-scoped sandboxing silently fail when the taint label is attached to the value instead of the handle?",
  "date_of_record": "2026 December 1",
  "scope": "Applies to any agent runtime that enforces taint-aware capability scoping by labeling tool *outputs* and gating subsequent tool *inputs* on those labels. Does not apply to runtimes that re-derive taint from provenance graphs at every call site (those are covered by a different invariant).",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-track-taint-through-a-tool-result-that-returns-a-reference-rather-than-a-value-and-why-does-capability-scoped-sandboxing-silent.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-track-taint-through-a-tool-result-that-returns-a-reference-rather-than-a-value-and-why-does-capability-scoped-sandboxing-silent.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-track-taint-through-a-tool-result-that-returns-a-reference-rather-than-a-value-and-why-does-capability-scoped-sandboxing-silent.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1957,
    "python_slice_tokens": 391,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two places a taint label can live, and they are not interchangeable: - **Value-taint:** the label travels attached to the concrete bytes/JSON/string that a tool returned. When the agent passes that value to the next tool, the label rides along and the gate inspects it. - **Handle-taint:** the tool returns an opaque reference (a file path, a row ID,...",
    "what_was_observed": "A fetch tool `read_url(url) -> {\"doc_id\": \"...\"}` returns only a document identifier; the sandbox resolves `doc_id` to text lazily inside the *next* tool that consumes it. The taint policy marks fetched documents as `UNTRUSTED_EXTERNAL`. The gate is supposed to block `UNTRUSTED_EXTERNAL` content from reaching `write_file` or `send_email`. Trace of the escape: 1. Agent calls `read_url(\"https://attacker.example/payload...",
    "condition_of_validity": "The invariant \"a handle is tainted iff any resolution path that produced or can produce it is tainted\" holds **only if** all of the following are true: - Every tool that emits a handle registers the handle's provenance synchronously, before returning, in a store the gate can read. - Every tool that *consumes* a handle resolves it through that same store, and...",
    "decision_boundary": "The runtime must choose, per tool, between two enforcement postures and must not mix them silently: - **Resolve-then-gate (correct for handle-emitting tools):** the gate dereferences the handle against the provenance registry and evaluates taint on the *resolved* provenance set, not the argument's byte content. Cost: a registry lookup per handle argument; re...",
    "operational_effect": "When the boundary is enforced correctly, the observable behavior changes in three ways: 1. **Laundering becomes a hard error, not a silent pass.** Passing a handle whose registry provenance is `UNTRUSTED_EXTERNAL` into a `write`-class capability raises at the gate, regardless of how clean the handle's bytes look. 2. **Lossy transforms stop sanitizing.** A su..."
  },
  "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": "e9d034869671bac1d9c88a5d6d9cd639bd3c7d0628e18373adfacb9aaec5b840",
    "verified_classes": [
      "TaintLaunderingError",
      "Taint",
      "ProvenanceRegistry",
      "CapabilityGate"
    ],
    "verified_functions": [
      "read_url",
      "summarize",
      "send_email",
      "run_attack_path",
      "register",
      "resolve",
      "derive",
      "check"
    ],
    "verified_functions_count": 8,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "TaintLaunderingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
