Skip to content

fix(minimald): name the range and refuse --public in min net expose (0.7.0 backport) - #2729

Closed
norrietaylor wants to merge 8 commits into
release/0.7.xfrom
fix/net-expose-range-public-0.7.0
Closed

norrietaylor wants to merge 8 commits into
release/0.7.xfrom
fix/net-expose-range-public-0.7.0

Conversation

@norrietaylor

@norrietaylor norrietaylor commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Backports #2718 (task T109, #2695) to release/0.7.0. When min net expose asks for a port outside the box's dynamic range, the refusal names that range. min net expose --public on 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

  • 78c4b8605 is the cherry-pick, with conflicts resolved to main's text. On this branch the ports code lives in crates/minimald/src/session.rs, not box_actor/ports.rs, so fix(minimald): name the range and refuse --public in min net expose (T109) #2718's hunks are applied there. In env.rs the new net-expose-public arm is added to the release branch's impl SessionChannel. It does not compile alone. Squash-merge the pair.
  • 2239cdddb adapts it to the release branch:
    • boxes:: becomes sessions::, and box_manager::BoxKeyPredicate::Id becomes sessions::SessionKeyPredicate::Id.
    • expose_public_refused_without_public_surface drops its channel_method assertion, 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.sh change applies unchanged.

Verification (Linux, Lima)

gominimal-aw-bot Bot and others added 4 commits October 27, 2026 20:37
* 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.
@norrietaylor
norrietaylor requested a review from a team as a code owner October 28, 2026 18:50
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 62647803-598c-49ad-a152-bcedae404986

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@minimal-foundry

minimal-foundry Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Reviewed: 1 finding, none blocking at b3ada2e00b65.

Address the comments on the diff.

Clobber: none seen.

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal-review — approved

Verdict APPROVE — No findings.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Oct 28, 2026
@norrietaylor

Copy link
Copy Markdown
Member Author

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.

@norrietaylor

Copy link
Copy Markdown
Member Author

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 (min net expose --public).

@norrietaylor norrietaylor reopened this Oct 28, 2026
norrietaylor and others added 3 commits October 28, 2026 12:49
…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.
@norrietaylor
norrietaylor force-pushed the fix/net-expose-range-public-0.7.0 branch from ad9dee7 to 2239cdd Compare October 28, 2026 19:50

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal-review — advisory review

Verdict COMMENT — 1 finding, 1 inline.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

Comment on lines +218 to +228
# `--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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@minimal-foundry minimal-foundry Bot removed the review:approved minimal-review approved the current head label Oct 28, 2026
…se-range-public-0.7.0

# Conflicts:
#	scripts/install-host-classifier.sh
norrietaylor pushed a commit that referenced this pull request Nov 5, 2026
…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)
@norrietaylor

Copy link
Copy Markdown
Member Author

Folded into #3019, which landed on release/0.7.x as ac7491e84.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant