Repository navigation
fix(minimald): name the range and refuse --public in min net expose (0.7.0 backport) - #2729
norrietaylor wants to merge 8 commits into
Conversation
* fix(minimal,minvmd): hold the answerer channel socket owner-only The box-zone answerer's channel socket was world-connectable: the launchd plist bound it SockPathMode 0666 and the systemd socket unit SocketMode=0666, leaving the peer-uid gate the only check on who may connect. Both units now bind it owner-only -- SockPathOwner the operator, SockPathMode 0600 on launchd; SocketUser the operator, SocketMode=0600 on systemd -- with the uid gate kept as defence in depth. An install whose socket node carries group or other bits -- one that predates the mode, or a hand that relaxed it -- now fails custody through a channel_mode fact, so the advisory re-surfaces and a step re-run re-binds the socket. The accept loop's foreign-refusal warn is rate-limited to a few lines a second, so a connect storm cannot flood the log; the refusals themselves are never limited. * fix(minimal,minimald,minvmd): name the other account on a refused channel connect A daemon whose connect the owner-only channel socket refuses now says the host's DNS service belongs to another account, not a bare Permission denied. The answerer step needs the operator's account to resolve, with no stand-in uid, and custody fails a channel socket the operator does not own. * fix(minimal,minvmd): leave another operator's DNS service alone A channel socket owned by another existing, non-root account is that operator's service: the answerer step is now unavailable with the same sentence the daemons say on a refused connect, instead of a custody failure whose step would reinstall the unit and take the service over. A root-owned socket, or one whose uid names no account, still fails custody so the step re-binds it. The minvmd tests that take the process-global foreign-refusal slots now run one at a time and start and end with every slot free, and the warn-rate test bounds the burst at two windows' worth of lines, so a slow runner that spreads the burst does not fail it. * fix(minimal): offer the step over a socket another account left behind A channel socket another account owns refuses the answerer step only when a service is installed; with none, the step's install removes the leftover socket before it loads the unit, so it is offered. --------- Co-authored-by: gominimal-aw-bot[bot] <281738952+gominimal-aw-bot[bot]@users.noreply.github.com> (cherry picked from commit 746770d)
…er (#2300) * fix(net): refuse out-of-zone names at a guest deny-subtree DNS listener A deny-all host-address box on a VM-backed guest resolved out-of-zone names at the switch gateway: the interim NET-079 carve-out admitted the gateway's port 53 whole, UDP and TCP, so a box that admits no destination could still ask a resolver beyond the machine — and DNS over TCP could retry past the verdict. The guest's deny subtree now steers its UDP-53 lookups onto a loopback listener on the answerer's port (NET-141 slice 2): deny_out admits the listener beside the reply direction, the dstnat match carries no destination address (the box asks the gateway like every other host-address box; the steer is the carve-out), and the listener itself answers REFUSED for every name outside the box zone — apex and a non-lowercase zone suffix among them — NODATA for an in-zone non-A question, and forwards the zone's A questions to the switch gateway alone. DNS over TCP is neither steered nor admitted. The guest daemon starts the listener after its classifier table loads; the daemon's own lookups are untouched (cgroup-keyed match, deny path only). The interim --gateway-resolver installer flag and every test, digest and pin that spelled the interim carve-out follow the new shape. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(net): bound and pin the guest DNS listener's forwards Connect each forward socket to the gateway so a datagram from any other sender is dropped, cap forwards in flight so a flood cannot exhaust the daemon's descriptors, and drop the needless to_string calls clippy rejects in the guest classifier integration test. * fix(net): refuse questionless and non-QUERY messages at the guest DNS listener decide() forwarded a message with no question, and an UPDATE or NOTIFY whose zone section named an in-zone A, because every per-question check passed vacuously. Answer the first REFUSED and the rest NOTIMP, so the forward path carries only standard lookups. Bind the listener directly so its log does not read as the box-zone answerer, pin the integration test's boot-log check to the exact example.com REFUSED line, and cite NET-079 (the deny-all case) rather than NET-141 at the lines this change added. --------- Co-authored-by: gominimal-aw-bot[bot] <281738952+gominimal-aw-bot[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> (cherry picked from commit 2c2f8cc)
crate::traced landed on main after the release branch was cut, so the cherry-pick of #2300 did not compile here.
v0.7.2 is tagged at the branch head, so the version check requires the next patch release.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
Reviewed: 1 finding, none blocking at Address the comments on the diff. Clobber: none seen. |
|
Closing: the 0.7.0 backports are limited to the network fixes the first slice's manual acceptance test needs (macOS names open). T109 is not one of them; it ships on main. The branch is kept, so this can be reopened. |
|
Reopened: the 0.7.0 backports cover every fix for a failure in the manual acceptance walkthrough, plus the security fixes. T109 fixes walkthrough item W25 ( |
…T109) (#2718) * fix(minimald): name the range and refuse --public in min net expose A port outside the box's --dynamic-range is refused with the range named, for allow and ask boxes alike, and an ask box refuses it before any prompt. min net expose --public is its own request and is refused because this host has no public surface. The host-refusal and port prompt texts stop naming the VM host daemon. * test(e2e): pin the new out-of-range expose refusal text The native-daemon-e2e lane still matched the old wording, so it failed on the text this branch ships. --------- Co-authored-by: minimal-foundry[bot] <327719912+minimal-foundry[bot]@users.noreply.github.com> (cherry picked from commit 1bbd45c)
…release/0.7.0 The cherry-picked change names main's files, types and helpers. Release/0.7.0 predates the box renames and the helper-request spans, so the change lands in the release's own code: - main's box_actor/ports.rs is session.rs here. The ports hunks (the host refusal texts, the ask comment, the "refused: out of range" outcome) apply to session.rs, in the cherry-pick commit itself. - The release has no CHANNEL_METHODS list or channel_method span helper, so the net-expose-public arm joins handle without a list entry, and expose_public_refused_without_public_surface drops its channel_method assertion. The refusal text and info line it pins are unchanged. - expose_out_of_range_refusal_names_range uses sessions:: for boxes:: and SessionKeyPredicate for BoxKeyPredicate. The behaviour is #2718's: a port outside --dynamic-range is refused with the range named for allow and ask boxes, before any prompt, and min net expose --public is refused because the host has no public surface.
ad9dee7 to
2239cdd
Compare
| # `--public` is its own request, never a port string. The | ||
| # daemon answers it, with or without a port. | ||
| if [[ "$1" == "--public" ]]; then | ||
| shift | ||
| if __min_is_help_flag "$1"; then | ||
| __min_usage expose | ||
| return 0 | ||
| fi | ||
| __min_rpc "net-expose-public" "$1" | ||
| return | ||
| fi |
There was a problem hiding this comment.
LOW · correctness · confidence 0.50 · in min_net
--public is only recognised as the first argument. min net expose 8080 --public skips the refusal. It sends net-expose 8080, because the helper reads only $1. The port is then published locally, although the user asked for public exposure. Scan all arguments for --public, or reject extra arguments.
What the reviewer checked
env_min_helper.sh:
local port="$1"then__min_rpc "net-expose" "$port"; the --public test is[[ "$1" == "--public" ]]only.
Hand this to an agent
Act on a code-review finding.
File: crates/minimald/src/env_min_helper.sh
Lines: 218-228
Category: correctness
Severity: low (reviewer confidence 0.50)
Finding:
`--public` is only recognised as the first argument. `min net expose 8080 --public` skips the refusal. It sends `net-expose 8080`, because the helper reads only `$1`. The port is then published locally, although the user asked for public exposure. Scan all arguments for `--public`, or reject extra arguments.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
…se-range-public-0.7.0 # Conflicts: # scripts/install-host-classifier.sh
…2718) T109. A port outside the box's --dynamic-range is refused with the range named, for allow and ask boxes alike, and an ask box refuses it before any prompt. min net expose --public is its own request and is refused because this host has no public surface. The host-refusal and port prompt texts stop naming the VM host daemon, and the session e2e script pins the new out-of-range text. Backport of #2718, folded from #2729. Adapted to the line: - main's box_actor/ports.rs hunks land in session.rs. - The line has no CHANNEL_METHODS list or channel_method helper, so the net-expose-public arm joins impl SessionChannel in env.rs without a list entry, and expose_public_refused_without_public_surface drops its channel_method assertion. The refusal text and log lines it pins are unchanged. - boxes:: becomes sessions:: and BoxKeyPredicate becomes SessionKeyPredicate. (cherry picked from commit 1bbd45c)
|
Folded into #3019, which landed on |
Backports #2718 (task T109, #2695) to
release/0.7.0. Whenmin net exposeasks for a port outside the box's dynamic range, the refusal names that range.min net expose --publicon a host with no public surface is refused, and nothing is published.Stacked on #2678; merge that first. #2678 carries the 0.7.3 version bump the release branch's version check needs. Until it merges, this diff also shows #2678's commits.
Commits
78c4b8605is the cherry-pick, with conflicts resolved tomain's text. On this branch the ports code lives incrates/minimald/src/session.rs, notbox_actor/ports.rs, so fix(minimald): name the range and refuse --public in min net expose (T109) #2718's hunks are applied there. Inenv.rsthe newnet-expose-publicarm is added to the release branch'simpl SessionChannel. It does not compile alone. Squash-merge the pair.2239cdddbadapts it to the release branch:boxes::becomessessions::, andbox_manager::BoxKeyPredicate::Idbecomessessions::SessionKeyPredicate::Id.expose_public_refused_without_public_surfacedrops itschannel_methodassertion, because that helper is not on this branch. It still checks the refusal text and the log lines.Both of #2718's new tests are kept. The
scripts/session-e2e.shchange applies unchanged.Verification (Linux, Lima)
just clippyis clean.expose_out_of_range_refusal_names_rangeandexpose_public_refused_without_public_surfacepass.minimaldsuite: 998 passed, 1 failed. The failure issession_host::tests::a_hook_launch_does_not_advise_unenforced_placement, the same VM-only cgroup EACCES failure seen on the unmodified fix(net): backport the deny-all DNS refusal and the owner-only answerer socket to 0.7.0 #2678 head. It is not caused by this change.