{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-an-mcp-tool-s-declared-egress-policy-as-void-because-the-sandbox-resolves-dns-before-the-policy-predicate",
  "title": "Under what conditions must an instance treat an MCP tool's declared egress policy as void because the sandbox resolves DNS before the policy predicate is evaluated",
  "date_of_record": "2026 December 2",
  "scope": "Applies to agentic runtimes that host untrusted MCP servers inside a network sandbox and enforce egress allow-lists per tool invocation. Does not apply to MCP servers executed in-process with the orchestrator (no network namespace boundary) or to purely local stdio tools with no socket capability.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-an-mcp-tool-s-declared-egress-policy-as-void-because-the-sandbox-resolves-dns-before-the-policy-predicate.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-an-mcp-tool-s-declared-egress-policy-as-void-because-the-sandbox-resolves-dns-before-the-policy-predicate.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-an-mcp-tool-s-declared-egress-policy-as-void-because-the-sandbox-resolves-dns-before-the-policy-predicate.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1725,
    "python_slice_tokens": 282,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not \"the sandbox leaked\" and not \"the allow-list was wrong.\" It is a **TOCTOU collapse between name resolution and policy evaluation**. An MCP server's tool manifest declares an egress policy (e.g., `allowed_hosts: [\"api.vendor.example\"]`). The runtime's egress proxy is expected to enforce that policy *at connect time*. But the sandbox's ...",
    "what_was_observed": "A tool declared: The runtime wrapped the MCP server in a network namespace with an egress proxy at `10.0.0.1:3128` and an iptables rule redirecting all TCP to the proxy. The proxy received a CONNECT to `93.184.216.34:443`. It checked the IP against `deny_private_ranges` (public — pass) and against the host allow-list. Because the allow-list was hostname-keyed and the request was IP-keyed, the proxy's fallback logic m...",
    "condition_of_validity": "The egress policy is only sound when **all three** hold: 1. **Resolution is trusted.** Name-to-address resolution is performed by a resolver the sandboxed process cannot intercept — either a sidecar resolver that the namespace routes to and the process cannot override via `nsswitch.conf`, `LD_PRELOAD`, or a bundled resolver library, or resolution performed *...",
    "decision_boundary": "The runtime must decide, per invocation, whether to **enforce** or **reject-and-renegotiate** the declared policy. The boundary: - If the MCP server's transport is TLS and the proxy terminates or inspects SNI → enforce on SNI. Sound. - If the transport is plaintext (HTTP, raw TCP, gRPC without TLS) → there is no hostname assertion. The proxy can only see IP....",
    "operational_effect": "When this boundary is crossed silently, three downstream effects follow: 1. **Audit divergence.** The runtime's egress log records `203.0.113.9` (or `93.184.216.34`), which reconciles against nothing in the tool manifest. Incident review concludes \"the allow-list was bypassed,\" but the actual mechanism is subject substitution, so the fix (tighten the allow-l..."
  },
  "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": "752b24e7012671537d799915f7b6e4c2d9c41a578e2b2d3abf23915c8b52b721",
    "verified_classes": [
      "EgressPolicyVoid"
    ],
    "verified_functions": [
      "enforce_egress"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "EgressPolicyVoid"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
