Repository navigation
T113 — Admit dns and both steering where the host's switch resolves box names - #2797
norrietaylor merged 17 commits into
Conversation
Creation and min box spec now read the box-zone resolver fact from the host kind: an own-address box on the VM host resolves through the switch, whose DNS gate steers the credential module's names. A native host still refuses dns and both steering with exit 3.
…and-both-steering-where-the-host-s-swi
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
…and-both-steering-where-the-host-s-swi # Conflicts: # crates/minimal/src/cmd/boxes/create.rs
…and-both-steering-where-the-host-s-swi
|
A merge of main before round 1, not counted against the cap (1 of 3), pushed as Resolved conflicts in:
Verify Converted to a draft: something above needs a person before review. On a VM host, a GitHub grant box with an own address and dns or both steering is now created, and min box spec shows the same steering. Its lookups go through the switch: github.com resolves to the proxy's address while the proxy listens, and gets SERVFAIL while the proxy is down. On a native host the box is still refused with exit 3. Notes from the agent: This round resolved the merge conflict with main in crates/minimal/src/cmd/boxes/create.rs. I kept host_resolves_box_names from this branch. I dropped store_item, because main removed it and nothing calls it now. Main added two SpecInputs initializers in the box_spec.rs tests. The merge commit gives each of them box_zone_resolver: false, so the test target compiles. cargo nextest run -p minimal box_spec also passes (6 tests). |
|
Approved: every review thread resolved at @norrietaylor resolved the last thread, which releases the approval this review had withheld. Nothing to do. |
norrietaylor
left a comment
There was a problem hiding this comment.
Requesting changes at 2cbde6a.
1. dns steering is admitted on the VM host, but a dns-only box cannot reach the proxy. crates/minimal/src/cmd/boxes/create.rs:341 (host_resolves_box_names, used at :1242).
- Under
dns, the gate answers github.com with the proxy's address.HTTPS_PROXYis not set, because BEP-012 sets it only forproxy_envorboth. So git opens TCP 443 to the proxy's address. - The relay admits only TCP 8118 at that address (
proxy_lane_admits,crates/boxes/src/core/egress.rs:1103). Everything else at that address is dropped. - The proxy listens only on 8118 (
crates/switch/src/bep_host.rs:166). It accepts only CONNECT or absolute-formhttp://(crates/bep/src/proxy.rs:440-486). It never reads a bare ClientHello. - Result: steering defaults to
dns(BEP-016). On macOS, a box with an unadorned GitHub grant used to be refused with exit 3 and told to setsteering = "proxy_env". With this change it is created, and every HTTPS connection to github.com times out with no message. This fails closed, so it is not a security problem. It is a correctness regression. The plan's proof, "git reaches GitHub through the proxy with no proxy variables", cannot pass. bothworks only for clients that readHTTPS_PROXY.
I am asking the owner which way to take this (keep refusing dns and admit only both, or add a 443 path at the proxy). The /revise will name the answer.
2. The min box spec half has no effect. crates/minimal/src/cmd/box_spec.rs:253, test near create.rs:3223.
renderpasses only the BEP-057 refusals through its filter (box_spec.rs:78-86), sobox_zone_resolvercannot change what it prints.- The test's
steering {word}check passes with the field set to false, so it proves nothing. - On a native host,
min box specstill shows adnsspec as fine, while creating that box exits 3. The plan saysmin box specand creation must agree. This comes from the interim in #2445, but the new test must fail when the two disagree.
Arch (local build:arch-review at arch 8640f85e): PASS_WITH_CONDITIONS. BEP-062 and BEP-078 conform. C1: the live proof did not run (git to GitHub through the proxy in a VM, with no proxy variables), and agent-verify timed out. File an issue for that end-to-end check and name it in the PR body as a residual.
The switch change is a test only. No address, port, protocol or per-box scoping changes, and default-deny is unchanged.
…and-both-steering-where-the-host-s-swi
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The change conforms. It admits dns and both steering only for an own-address box on the VM host. That is the one place where the attach builds a steered DNS gate with the switch's listener state (networking §5.4 line 169, §7.1 line 244). Every other host and mode keeps the BEP-017 refusal with exit 3, so the check fails closed. The new switch test proves SERVFAIL while the proxy is down and the proxy address while it is live. The live-VM proof did not run. This ruling does not depend on it.
Ruled at 2cbde6a against gominimal/arch@8640f85e193d by claude-opus-5-5.
A dns-only box gets the proxy's address for github.com but has no HTTPS_PROXY, so git opens port 443 at an address where only the proxy port is admitted and the proxy reads only CONNECT or absolute-form requests. Keep dns refused on every host until the proxy takes a direct TLS connection, and admit both where the VM host's switch steers names. min box spec now previews the BEP-017 refusal from the same host fact creation reads, and the test fails if the two disagree.
There was a problem hiding this comment.
arch-review: CONDITIONS · 2 conditions · the full ruling
The change now refuses dns steering on every host, and that refusal fails closed correctly. But dns is the design default (§5.4 line 169), and the gap is in the proxy: §5.7 line 208 says the proxy terminates TLS for steered flows. The interim has no issue, so file one and link it (C1). The refusal also sets HostFacts::box_zone_resolver to false on the VM host. As a result, the message and the info line say the host has no box DNS resolver, which is false. Keep the resolver fact a host fact and give the dns interim its own refusal and spec requirement (C2).
Ruled at 1dd3ce1 against gominimal/arch@8640f85e193d by claude-opus-5-5.
|
The owner's answer to finding 1 of my review: admit only
If the round now running already took another direction, I will post a |
|
Round 1 of 10 on a review requesting changes, pushed as
Verify Converted to a draft: something above needs a person before review. On the VM host, an own-address GitHub grant box with steering = "both" is created. Its switch steers the GitHub names to the proxy while the listener is live and answers SERVFAIL while it is down, so its credentialed names fail closed. Notes from the agent: Review item 1 (dns admitted but cannot reach the proxy): valid. The review defers the direction to the owner, and this directive names no answer. I took the fix that holds under both answers. host_resolves_box_names now takes the resolved steering and is true only for |
|
/revise Round 1 took the owner's direction: admit only
Change nothing in |
… fact host_resolves_box_names reads only the host kind and the network mode again, so box_zone_resolver is true for an own-address box on the VM host whatever its steering. A new DnsWithoutDirectTls refusal (exit 3) covers dns steering with a credentialed upstream where the host has the resolver: it says the Box Egress Proxy does not yet take a direct TLS connection and names both remedies. The interim lifts with #2805. min box spec previews the new refusal, so it refuses exactly when creation does, for both refusals.
|
Round 2 of 10 on a /revise note, pushed as
Verify Converted to a draft: something above needs a person before review. Review threads the coder judged:
On the VM host, an own-address GitHub grant box with steering = "both" is created, and Notes from the agent: Revise round 2. C2: host_resolves_box_names reads only the host kind and the network mode again, so HostFacts::box_zone_resolver is a host fact, and the info line logs the true value. The new BepRefusal::DnsWithoutDirectTls fires for dns steering with a credentialed upstream where the resolver is present. It exits 3. Its text is pinned in both test lines and in steering_defaults_to_dns. NoResolver is unchanged. Its log rule is "BEP-017 interim (#2805)", because the spec has no requirement ID for it yet. min box spec previews the new variant. I updated two older bep tests (steering_defaults_to_dns, a_store_grant_parses_store_and_id_not_a_broker_scope), because they assumed that default dns was admitted with the resolver. C1: the spec document is outside this task's layers, and the coder instructions forbid me to open it. So I did not add the note next to BEP-017 that points at #2805. A follow-up must add it. Please put #2805 in the PR body as the issue that lifts the dns refusal, and put the unrun live VM proof under both steering as a residual. switch.rs is unchanged this round. This round did not run |
|
/revise Round 2 meets arch C2. Keep
Do not touch the spec in this PR. |
…and-both-steering-where-the-host-s-swi # Conflicts: # crates/minimal/src/cmd/boxes/create.rs
|
/revise Thread PRRT_kwDOPdfcxM6yUC20 is valid. My earlier support for the dispute on PRRT_kwDOPdfcxM6ySe7c was wrong.
Change nothing else. |
…and-both-steering-where-the-host-s-swi
min box spec computed the box DNS resolver fact for an own_ip box, but min box create defaults --network to host_ip. On the VM host the preview accepted a both-steered grant box that a default creation refused. The preview now reads the --network default from the flag's definition.
…and-both-steering-where-the-host-s-swi
norrietaylor
left a comment
There was a problem hiding this comment.
Approving at eff2b89. Round 5 fixes the preview mismatch:
min box specreadsbox_zone_resolverthroughpreview_box_zone_resolver, for the network of a default box.default_box_network()takes that network from the--networkflag's own clap default (host_ip), so it cannot drift.- The new test asserts that a default
min box createandmin box specgive the same refusal on the VM host and the native host.
Everything else in the compare comes from the merges of main (#2801, #2808).
|
Round 5 of 10 on a /revise note, pushed as
Verify Converted to a draft: something above needs a person before review. Review threads the coder judged:
On the VM host, an own_ip GitHub grant box with steering = "both" is admitted, and Notes from the agent: Round 5 changes only what the directive asks for. The new create.rs function |
There was a problem hiding this comment.
arch-review: PASS_WITH_CONDITIONS · 1 condition · the full ruling
This push makes the min box spec preview agree with a default min box create, and the preview now fails closed. The switch gate and the admission rules keep the status of the last ruling. One gap stays open. min box create --network own_ip admits a both grant box on the VM host, but the preview of that box refuses it. Design line 476 gives min box spec a --network <mode> flag, and line 489 says the preview shows what the entry gets. Add the flag as C1 says, or file C1 as an issue and link it from the PR.
Ruled at eff2b89 against gominimal/arch@8640f85e193d by claude-opus-5-5.
|
Round 6 of 10 on the runtime's review findings: the coder changed nothing. Revise round 6. I changed no code this round. The one open thread asks min box spec to show the own_ip admission. That needs a --network flag on BoxSpecArgs in crates/minimal/src/cli.rs, which is outside the task's layers. A follow-up issue can add it, and box_spec.rs can then pass that network to host_resolves_box_names in place of default_box_network(). I ran all three test lines at the merged head (a322bbbd), and each one passed. Review threads the coder judged:
|
|
/revise The owner accepted
Change nothing else. |
…and-both-steering-where-the-host-s-swi
min box spec previewed a host_ip box, so it refused a both-steered grant box on the VM host that min session activate --network own_ip admits. The flag now shares one definition (parser, default, help) with min session activate --network. The preview builds its spec and reads the host fact from that network, and it now previews the no-network refusal that the network decides.
…and-both-steering-where-the-host-s-swi
There was a problem hiding this comment.
minimal-review — approval withheld
Verdict COMMENT — APPROVE withheld: 3 unresolved threads — minimal-foundry[bot] crates/minimal/src/cmd/box_spec.rs, minimal-arch[bot] crates/minimal/src/cmd/box_spec.rs, minimal-arch[bot] crates/minimal/src/cmd/box_spec.rs. No findings.
Panel: 3 of 3 personas ran (correctness, security, supply-chain).
There was a problem hiding this comment.
arch-review: PASS_WITH_CONDITIONS · 1 condition · the full ruling
The compare conforms. min box spec --network now shares one definition with min session activate --network. The preview reads the same host fact as creation, as architecture.md line 1202 requires. The steered switch gate is unchanged from the baseline. The live VM proof is still open. C1 keeps it as the #2813 residual, and #2805 stays a residual for dns steering.
Ruled at 3345800 against gominimal/arch@8640f85e193d by claude-opus-5-5.
norrietaylor
left a comment
There was a problem hiding this comment.
Approving at 3345800. Round 7 meets the minimal-arch C1 on eff2b89:
min box spectakes--network. The value name,host_ipdefault and help are shared withmin session activatethroughNETWORK_*incli.rs.SpecInputscarries the network.renderbuilds the spec from it, andpreview_hostreadshost_resolves_box_names(kind, network).- The test parses real argv for both commands for each mode and host kind, and asserts the same refusals.
docs/reference/cli-min.mddocuments the flag.
cli.rs is in scope by the owner's decision. The rest of the compare comes from merges of main.
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 3345800b9201 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.
|
Round 7 of 10 on a /revise note, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
On the VM host, a GitHub grant box with both steering is admitted by min session activate --network own_ip, and min box spec --network own_ip now shows the same box with 'steering both'. With no flag, or with any other mode, or on a native host, both commands refuse the spec with exit 3 and the same text. The switch test pins that a steered name resolves to the proxy while its listener is live and fails closed while it is down. Notes from the agent: Revise round 7. cli.rs: the owner accepted it into scope. min box spec takes --network <none|host_ip|own_ip>. The flag uses the same parse_network_mode, default and help as min session activate --network, through the shared constants NETWORK_VALUE_NAME, NETWORK_DEFAULT, NETWORK_HELP and NETWORK_LONG_HELP. I did not flatten a shared struct into ActivateArgs, because that breaks the ActivateArgs struct literals in list.rs, attach.rs, vm_host.rs and tests.rs, which are outside the layers. The rendered help of min session activate is unchanged. The directive says 'min box create'. The command that creates a box from ActivateArgs is min session activate, so the tests and docs name that command. SpecInputs has a network field now. render builds its ActivationSpec from it. cmd_box_spec computes box_zone_resolver through preview_host, which calls host_resolves_box_names(kind, network). Creation computes its fact through the new creation_host(kind, &ActivateArgs). preview_box_zone_resolver and default_box_network are removed. One change beyond the directive's list: render now also previews BepRefusal::NoNetworkWithGrant (BEP-009). Without it, --network none gives different refusals from the two commands, so item 3 cannot hold. The test parses real argv for both commands, for no flag and for each mode on both host kinds, and asserts the same network, the same host fact and the same refusal text. Creation gets an egress that allows the GitHub hosts in the test, because min box spec has no egress flags and the preview …[truncated] |
T113 — Admit dns and both steering where the host's switch resolves box names
slice: S16
kind: task
covers: BEP-062, BEP-078
size: M
est: 120 code, 180 tests
executor: agent
difficulty: needs care
model: standard
diagnostics: on a host whose switch steers box lookups, a grant box with
steering = "dns"or"both"is created, andmin box specshows the steering it resolves to; on a native host it is still refused with exit 3 and "This box declares a secret with steering = "dns", but this host has no box DNS resolver. Set steering = "proxy_env" in [network.bep].", pinned by dns_steering_is_admitted_where_the_switch_resolves_boxesobservability: the existing info line of each creation's activation check carries the host fact it used,
box_zone_resolver, beside its rule and fieldslayers:
- activation:
- crates/minimal/src/cmd/boxes/create.rs:
refuse_unhonourable_grantssetsHostFacts::box_zone_resolverfrom the host, not fromHostFacts::LOCAL: true where the box's lookups go through the VM host's switch, whose DNS gate steers the credential module's names and asks the proxy's listener (ProxyListenerState::for_switch, T58), and false on a native host, where a steered name always fails closed; the doc line "Every host today is un-enrolled and has no box-zone resolver." goes (#2523)- crates/minimal/src/cmd/box_spec.rs: the preview reads the same host fact, so
min box specand creation agree- crates/boxes/src/core/bep.rs: the doc of
HostFacts::box_zone_resolverand ofHostFacts::LOCALsay where the fact comes from; the BEP-017 refusal is unchanged where the fact is falsetest: cargo nextest run -p minimal dns_steering_is_admitted_where_the_switch_resolves_boxes
test: cargo nextest run -p boxes prop_dns_steering_without_resolver_is_exit_3
- gate:
- crates/minimald/src/net/switch.rs: a test builds a
dns-steered box's gate as the VM host attaches it, and pins that github.com resolves to the proxy's address while its listener is live and gets SERVFAIL while it is down, never a real addresstest: cargo nextest run -p minimald a_dns_steered_grant_box_resolves_the_module_through_the_switch
produces: none
consumes: none
proof: On a host whose switch resolves box names, a GitHub grant box with dns steering is created, git reaches GitHub through the proxy with no proxy variables, and its credentialed names fail closed while the proxy is down.
depends on:
- blocked by #2264
- blocked by #2281
- blocked by #2538
Original issue text
Residual filed from T30 #2519, arch condition C1 at 9b90b4d (review threads 4368950923 and 4368950924), epic #1501.
Situation
T30 adds
DnsGate::with_steeringandProxyListenerStateincrates/minimald/src/net/dns_gate.rsandcrates/minimald/src/net/dns.rs: a steered A lookup answers the Box Egress Proxy's address while its listener is live and SERVFAIL while it is down, and AAAA, HTTPS and SVCB lookups of a steered name answer NODATA. Both carryallow(dead_code)outside the tests, because no production code calls them:BoxGate::for_sessionincrates/minimald/src/net/switch.rsbuilds the gate without steering, and nothing reports the listener's state. So in a running daemon a credentialed name of adnsorbothbox is still forwarded to real DNS while the proxy is down. The switch and the bep host were outside T30's layers.What closes this
BoxGate::for_session(crates/minimald/src/net/switch.rs) callsDnsGate::with_steering(policy, <credential module hosts>, <proxy address on the switch>, <shared ProxyListenerState>)for every box whose steering resolves todnsorboth.ProxyListenerState::set_livewhen the proxy's listener comes up and when it goes down, so one state is shared by every gate on the switch.allow(dead_code)interims onProxyListenerStateandwith_steeringgo, and their comments stop naming this issue.Generated by Claude Code
Proof
On the VM host, an own-address box with a GitHub broker grant and steering = "dns" or "both" (or no steering declared) now passes the creation check, and
min box specshows the steering it resolves to. Its switch gate answers github.com with the proxy's address while the proxy listens, so git reaches GitHub through the proxy with no proxy variables. It answers SERVFAIL while the proxy is down. On a native host the same spec is still refused with exit 3 and the no box DNS resolver message.Notes from the agent: The host fact is
host_resolves_box_names(kind, network)in create.rs. It is true only for HostKind::Minvmd with network = own_ip. A host_ip or none box on the VM host keeps the refusal, because only an own-address box gets a steered DNS gate of its own. Themin box specpreview assumes an own-address box, as its checks did before. The preview still filters to the BEP-057 refusal (#2445), so it does not show the BEP-017 refusal on a native host. The observability fact goes in two places: a new info line in refuse_unhonourable_grants ('checked the box spec's grants against this host', with box_zone_resolver, steering and accepted), and the box_zone_resolver field on check_activation's existing per-refusal debug line, beside rule and fields. Nothing in this session ran the end-to-end proof that git reaches GitHub in a live VM. The minimald unit test covers the gate's DNS answers only.just clippy-strictwas not run. clippy -p minimald -p minimal -p boxes --all-targets is clean.Tests
cargo nextest run -p minimal dns_steering_is_admitted_where_the_switch_resolves_boxescargo nextest run -p boxes prop_dns_steering_without_resolver_is_exit_3cargo nextest run -p minimald a_dns_steered_grant_box_resolves_the_module_through_the_switchVerify
min task run agent-verifytimed out after 1800s, so this PR is a draft.Base
The base branch moved while the coder worked; it was merged in before the tests ran.
Closes #2523
Residuals
dnssteering stays refused with exit 3 on every host (DnsWithoutDirectTlson the VM host, BEP-017 elsewhere). T116 — Carry dns-steered TLS to the proxy on port 443 #2805 tracks the direct TLS path at the proxy that lifts it (arch C1 on 1dd3ce1).bothsteering in a VM, with no extra tool configuration. Prove both steering live: git reaches GitHub through the proxy from a VM box #2813 tracks it. CI covers the switch's DNS answers and the admission rules only.both, a tool that ignoresHTTPS_PROXYgets the proxy's address, and the switch drops its TCP connection to port 443 with no reset, so it stalls. T116 — Carry dns-steered TLS to the proxy on port 443 #2805 closes this too.