fix(control): pin control-client to direct loopback + CONTROL_METHODS/dispatch lockstep guard (#711)#49
Merged
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
…the control method table (#711) Two control-plane hardening follow-ups from the #45 CLI-parity gates: 1. no_proxy pin: the operator loopback control client now builds its reqwest client with `.no_proxy()`, so a hostile `HTTP_PROXY`/`HTTPS_PROXY` in the environment can no longer route the token-bearing `control.*` POST through an attacker-controlled proxy. reqwest's default proxy behaviour has no automatic loopback bypass; the control plane is loopback-only + token-gated, so the transport is now pinned DIRECT to 127.0.0.1/::1. 2. CONTROL_METHODS <-> dispatch_control lockstep: dispatch_control now routes owned methods via the new OWNED_CONTROL_METHODS routing const (delegating the rest to the node), and a lockstep test asserts CONTROL_METHODS equals OWNED_CONTROL_METHODS + DELEGATED_CONTROL_METHODS exactly (disjoint union). This closes the shell-owned-method drift gap the cli_covers_* test leaves open. The owned match's `_` arm is unreachable by construction. TDD: both tests verified RED first (proxy test dialed the dead proxy; partition test caught an injected drift entry). fmt + clippy -D + full lib suite (213) green. Version bumped 0.38.1 -> 0.38.2 (patch: defense-in-depth hardening, no public-API or behaviour change to the shipped surface). SPEC §7.3 updated. Refs #426 #501 Co-Authored-By: Claude <noreply@anthropic.com>
MichaelTaylor3d
marked this pull request as ready for review
July 17, 2026 12:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes DIG-Network/dig_ecosystem#711.
What changed
Two dig-node control-client hardening follow-ups from the #45 CLI-parity gates (both defense-in-depth; neither blocked #45).
no_proxypin (control_client.rs). The operator loopback control client now builds its reqwest client viabuild_control_client()with.no_proxy(). reqwest's default env-proxy behaviour has NO automatic loopback bypass, so a hostileHTTP_PROXY/HTTPS_PROXYcould route the token-bearingcontrol.*POST (carrying the master control token) through an attacker proxy. The transport is now pinned DIRECT to 127.0.0.1/::1. (server.rs'shttpclient is the OUTBOUND upstream/rpc.dig.net client, not a control client — correctly left proxy-honoring.)CONTROL_METHODS↔dispatch_controllockstep (control.rs).dispatch_controlnow routes owned methods via a newOWNED_CONTROL_METHODSrouting const (delegating the rest to the node's control surface); the ownedmatch's_arm isunreachable!by construction. A new testcontrol_methods_partition_into_owned_and_delegatedassertsCONTROL_METHODSequalsOWNED_CONTROL_METHODS∪DELEGATED_CONTROL_METHODSexactly (disjoint union), closing the shell-owned-method drift gap the existingcli_covers_every_node_control_methodtest leaves open.Blast radius (gitnexus + grep)
build_control_client/call_async(control_client.rs) — only caller iscall_control(the CLI control path); no behaviour change beyond proxy-pinning.dispatch_control(control.rs) — refactor is behaviour-preserving (same owned arms, same delegation);CONTROL_METHODSpublic const unchanged (consumed by control_cli.rs drift test + dig-browser controller). No wire/API change.Tests (TDD, both RED-verified)
control_client::tests::control_client_ignores_http_proxy_and_connects_direct— RED without.no_proxy()(dialed the dead proxy 127.0.0.1:9).control::tests::control_methods_partition_into_owned_and_delegated— RED with an injectedOWNEDdrift entry.Gates
fmt --check clean · clippy -D warnings clean · full
dig-node-servicelib suite 213 passed. (Path-length MAX_PATH forces a redirectedCARGO_TARGET_DIR; CI unaffected.)Version
0.38.1→0.38.2— patch: defense-in-depth hardening + a test; no public-API or behaviour change to the shipped surface. Apps/nightlies → rides the next nightly; stable is manual.Refs #426 #501.
🤖 Generated with Claude Code