Repository navigation
T138 — The hostname proxy refuses a host-address port that listens on 127.0.0.1 only - #2966
Conversation
A host-address route now reads its port's listeners from the daemon's own /proc/net/tcp and /proc/net/tcp6, so the proxy can tell a port that only a 127.0.0.1 listener holds (NET-071).
A request by a host-address box's name to a port that only a 127.0.0.1 listener holds now gets 403 before anything is dialed, with a body that says to bind the port to 0.0.0.0. The network policy violation line names the rule loopback-only listener. Test backends for host-address routes now listen at 0.0.0.0 (NET-071).
The hostname proxy now refuses a host-address port that only a 127.0.0.1 listener holds (NET-071), so the backend these tests route a box name to listens at 0.0.0.0.
The hostname proxy refuses a host-address box's port that a listener holds only at 127.0.0.1, and tells the user to bind it to 0.0.0.0.
…me-proxy-refuses-a-host-address-port-t
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
Spec lint
Advisory. None of this blocks the merge; the review decides. Advisory, and never a merge gate. Linter: |
The hostname proxy now refuses a host-address port that only a 127.0.0.1 listener holds (NET-071). The root-lane and VM-lane proofs that reach a deny-all box through the proxy bound their backend at 127.0.0.1, so the proxy refused them with 403.
|
Round 1 of 10 on a failed check suite, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. A request through the hostname proxy to a host_ip box's port that only a 127.0.0.1 listener holds gets 403 with the body telling the user to bind the port to 0.0.0.0, and a host service on 127.0.0.1 is never reached by a box name. The root-lane and VM-lane proofs that reach a deny-all box by name now bind their backend at 0.0.0.0, so they exercise the forwarding path again. Notes from the agent: Revise round 1: CI failures. minimald-root-integration failed in deny_all_host_ip_box_answers_the_proxy_over_a_loaded_table because its forked backend bound 127.0.0.1, and the new check refuses that port with 403. test-kvm runs guest_deny_all_box_answers_inbound_through_the_proxy, whose in-box python server also bound 127.0.0.1. The test-kvm log excerpt did not name the failing test, so this cause is my inference from the code. Both backends now bind 0.0.0.0. A port with no listener yet still forwards and fails its dial, so the VM client's retry loop still works. Both files are outside the task's layers. They are test files only, and the task's own behaviour change breaks them. ci-linux-kvm-success is the aggregator of test-kvm. I could not run the root-lane proof here (no nft, so it skipped) or the VM harness (no KVM). Those lanes must confirm the fix. I checked scripts/session-e2e.sh: its 127.0.0.1 host listeners are reached directly and not by a box name, and its in-box socat listeners bind 0.0.0.0 by default, so it needs no change. |
|
Approved: every review thread resolved at @norrietaylor resolved the last thread, which releases the approval this review had withheld. Nothing to do. |
…me-proxy-refuses-a-host-address-port-t
There was a problem hiding this comment.
arch-review: CONDITIONS · 2 conditions · the full ruling
The change refuses a host_ip box's port when only a 127.0.0.1 listener holds it. Section 7.1 line 254 says the host_ip lane does not filter. Line 261 says a native box's name answers at 127.0.0.1, where its sockets sit. So the proxy now refuses the box's own port, which a direct connection by name reaches. Remove the refusal and the new NET-071 sub-requirement (C1). Restore the 127.0.0.1 test listeners (C2). How the proxy keeps box names off host services is a design question, and it is escalated.
Ruled at 72bb53f against gominimal/arch@7a86ec7bb3c0 by claude-opus-5-5.
The check now reads the listeners at the address the proxy dials, not the route's address. It refuses with 502 when the socket tables cannot be read or the blocking task does not finish. Only a listener at exactly 127.0.0.1 gives the loopback-only verdict, so the refusal body is true.
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The compare closes the open faults. The loopback-only check now reads the address that the proxy dials. It refuses with 502 when it cannot read the socket tables. Only a listener at exactly 127.0.0.1 gives the refusal, so the message is true. Section 7.1 lines 254 and 261 govern, and the change conforms to them.
Ruled at 182c9fd against gominimal/arch@7a86ec7bb3c0 by claude-opus-5-5.
|
Round 2 of 10 on the runtime's review findings, pushed as
Verify Review threads the coder judged:
A request through the hostname proxy to a host_ip box's port that only a 127.0.0.1 listener holds gets 403 with the body "The box listens on this port at 127.0.0.1 only. Bind it to 0.0.0.0 to reach it by name." The check reads the listeners at the address the proxy dials, also inside a VM. When the daemon cannot read its socket tables, the request gets 502 and is not forwarded. So a host service on 127.0.0.1 is never reached by a box name. Notes from the agent: Revise round 2. This round changes only dns.rs and proxy.rs. ListenerReach has a new Unreadable variant. The proxy answers it, and a spawn_blocking join error, with 502 Bad Gateway and no body. A failed dial gets the same answer. Each 502 logs a warn line. A /proc/net/tcp6 that does not exist is a kernel without IPv6, so it is skipped and is not counted as unreadable. The refusal body is the fixed text from the task, so it stays as written. Its words "The box listens" can be wrong when the 127.0.0.1 listener is a host service. I ran only the two test: lines, not the whole crate suite and not just ci. |
|
/revise Close out the six open threads. The arch ruling at |
|
That What the platform saidcould not start the coder: Error: there is no container instance that can be provided to this durable object Nothing to type again: the command gets a rocket when its round starts, or a refusal that names the reason. No round was counted for it yet. |
…me-proxy-refuses-a-host-address-port-t
A listener at another specific address no longer makes a port that a 127.0.0.1 listener holds reachable, and the verdict no longer depends on row order.
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The compare to 182c9fdc is one commit. It makes listener_reach in dns.rs follow the listener that the dial reaches, and the verdict no longer depends on row order. With a dial to 127.0.0.1, any 127.0.0.1 listener now gives a refusal, also beside a wildcard listener. That closes a path to a host service and agrees with §7.1 line 254. The rest of the change keeps the PASS from 182c9fdc. There are no conditions.
Ruled at cee1b4b against gominimal/arch@7a86ec7bb3c0 by claude-opus-5-5.
There was a problem hiding this comment.
minimal-review — approval withheld
Verdict COMMENT — APPROVE withheld: 6 unresolved threads — minimal-arch[bot] crates/minimald/src/net/proxy.rs:783, minimal-arch[bot] crates/minimald/src/net/dns.rs:622, minimal-arch[bot] docs/specs/18-spec-box-networking/18-spec-box-networking.md:611, minimal-arch[bot] crates/minimald/tests/classifier_root_integration.rs:554, minimal-foundry[bot] crates/minimald/src/net/dns.rs, …. No findings.
Panel: 3 of 3 personas ran (correctness, security, supply-chain).
|
Round 3 of 10 on a /revise note, pushed as
Verify Review threads the coder judged:
A request through the hostname proxy to a host_ip box's port that a 127.0.0.1 listener holds gets 403 with the text that tells the user to bind it to 0.0.0.0. A box listener at another address, such as 10.0.0.5, or a wildcard listener beside it, no longer lets the proxy reach a 127.0.0.1 host service by the box's name. Notes from the agent: This round fixes the two HIGH threads. listener_reach now collects every row on the port before it gives a verdict, so the row order does not change the result. When the dial is 127.0.0.1, any 127.0.0.1 listener (v4 or v4-mapped) makes the port loopback-only, because the kernel gives a connection to the exact-address listener before a wildcard one. A listener at another specific address is ignored. The unit test now asserts NoListener for 10.0.0.5:7070, and it adds cases for both row orders, for 0.0.0.0 beside 127.0.0.1, and for a :: listener beside 127.0.0.1. The NET-071 rationale comment in the spec now states the same rule. The refusal stays, as the /revise note asks, because the arch ruling at 182c9fd replaces the four arch threads. The note also asks for the threads to be resolved. I did not resolve them, because resolution is the reviewer's decision. |
There was a problem hiding this comment.
minimal-review — approved
Verdict APPROVE — every review thread is resolved; @norrietaylor closed the last one. The review of cee1b4b94ab6 withheld this approval on the threads open then. Posted as a comment: the App cannot approve its own pull request; the check and the label carry it.
There was a problem hiding this comment.
Reviewed against T138's plan block. A request to a host-address port that only a 127.0.0.1 listener holds is refused with 403 before the dial, and a check that cannot run refuses with 502. listener_reach now judges only what the dial reaches, which closes both HIGH threads. Arch-review passes on this head, and that ruling replaces the arch threads from 72bb53fa.
T138 — The hostname proxy refuses a host-address port that listens on 127.0.0.1 only
slice: S0
kind: task
covers: NET-071
size: M
est: 150 code, 200 tests
executor: agent
difficulty: needs care
model: standard
diagnostics: what a person reads is the refusal: a request through the hostname proxy to a
host_ipbox's port that only a 127.0.0.1 listener holds gets 403 with the body "The box listens on this port at 127.0.0.1 only. Bind it to 0.0.0.0 to reach it by name.", pinned by proxy_refuses_loopback_only_host_address_port;min bugbundles carry the daemon log, whose refusal line names the ruleloopback-only listenerobservability: the proxy's
network policy violationline carriesrule_matched="loopback-only listener"with the box and the portlayers:
- route:
- crates/minimald/src/net/dns.rs: a host-address route forwards a port only while a listener holds it at 0.0.0.0 or another non-loopback address, read from the daemon's own
/proc/net/tcp; a port that only a 127.0.0.1 listener holds gives a loopback-only verdict, on a native daemon and inside a VM aliketest: cargo nextest run -p minimald loopback_only_listener_read_from_proc_net_tcp
- proxy:
- crates/minimald/src/net/proxy.rs: a loopback-only verdict is refused 403 with the body
The box listens on this port at 127.0.0.1 only. Bind it to 0.0.0.0 to reach it by name.and the ruleloopback-only listener, before anything is dialedtest: cargo nextest run -p minimald proxy_refuses_loopback_only_host_address_port
- spec:
- docs/specs/18-spec-box-networking/18-spec-box-networking.md: NET-071 gains a sub-requirement: IF a request through the hostname proxy targets a host-address box's port that a listener holds only at 127.0.0.1 THEN THE SYSTEM SHALL refuse it and tell the user to bind the port to 0.0.0.0; tier T0, verified by proxy_refuses_loopback_only_host_address_port
produces: none
consumes: none
proof: A request through the hostname proxy to a
host_ipbox's port bound to 127.0.0.1 only is refused with 403, telling the user to bind it to 0.0.0.0, and a host service on 127.0.0.1 is never reached by a box name.Proof
A request through the hostname proxy to a host_ip box's port that only a 127.0.0.1 listener holds now gets 403 Forbidden with the body "The box listens on this port at 127.0.0.1 only. Bind it to 0.0.0.0 to reach it by name." The proxy never dials that listener, so a host service on 127.0.0.1 is not reached by a box name. The same box's port at 0.0.0.0 still forwards. The daemon log has a
network policy violationline with rule_matched="loopback-only listener", the box and the port.Notes from the agent: Out of scope: I changed crates/minimald/src/server/tests.rs. Its spawn_backend_saying helper put a host-address backend at 127.0.0.1, and the new refusal correctly refused it, so proxy_listens_on_configured_port and proxy_auto_selects_free_port expect 200. The helper now listens at 0.0.0.0. For the same reason, the test backends in proxy.rs (spawn_backend and the per-test backends) now listen at 0.0.0.0. The check is in the proxy (proxy.rs), after the shared verdict and before the dial, because the verdict function is in switch.rs, which is outside the layers. Design choices: a listener at 0.0.0.0, ::, or a non-loopback address is reachable. A listener at the route's own address is also reachable when that address is not 127.0.0.1, for a node address in the reserved 127/8 range. A port with no listener, or socket tables that cannot be read, forwards as before and fails as 502/504. It is not refused, because the code cannot prove the loopback-only cause. Not run:
just lint-proseon the spec, because vale is not installed on this box. Also not run:just clippy-strict.cargo clippy -p minimald --all-targetsandcargo fmt --checkare clean.Tests
cargo nextest run -p minimald loopback_only_listener_read_from_proc_net_tcpcargo nextest run -p minimald proxy_refuses_loopback_only_host_address_portVerify
min task run agent-verifypassed ([tasks.verify]).Base
The base branch moved while the coder worked; it was merged in before the tests ran.
Out of scope
These files are outside the task's
layers:, so this PR is a draft:crates/minimald/src/server/tests.rsCloses #2932