8000 fix(bep): a kept box loses its Box Egress Proxy hosts after the proxy restarts · Issue #4077 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(bep): a kept box loses its Box Egress Proxy hosts after the proxy restarts #4077

Backlog

Description

@norrietaylor

What happens

A box that uses the Box Egress Proxy loses every proxy-served host after the proxy restarts. The box keeps running, and its declared egress is unchanged, but each request to a credentialed upstream host is refused:

$ min box exec <box> -- curl -sS https://api.github.com/zen
{"message":"The Box Egress Proxy refused the request to api.github.com:443, because this box is not allowed to reach api.github.com:443."}

$ min box exec <box> -- git ls-remote https://github.com/<owner>/<repo> HEAD
remote: The Box Egress Proxy refused the request to github.com:443, because this box is not allowed to reach github.com:443.

The message is wrong for this case. min box spec <box> and min box show <box> --network both list github.com and api.github.com under allow_dns_hosts. Hosts that do not go through the proxy still work from the same box.

The proxy restarts whenever minvmd or the VM restarts. An upgrade restarts both, so every box kept across an upgrade to 0.8.0 that holds a GitHub grant or a store secret is affected. A reboot has the same effect.

Observed

  • Host: macOS arm64, VM provider, upgraded in place from a 0.8.0 dev build to 0.8.0-rc1.
  • Box: a session box created under the dev build, with mode = "own_ip", [defaults.network.bep] steering = "dns", a GH_TOKEN secret with source = "broker", and eight hosts in allow_dns_hosts.
  • The proxy's audit log holds about 4,690 admit decisions for the box before the restart. After the restart it holds only "decision":"refuse","marker":"outside_declared_egress" for the same box.
  • At the restart minvmd logged that it reloaded the box's row and named the live boxes to the proxy. It did not send the box's egress.
  • DNS steering still works: github.com resolves to the proxy address inside the box.

Cause

The proxy keeps each box's declared egress in memory only, and only box creation registers it. Citations are from main at cc059f7.

  • crates/bep/src/boxes.rs:41: the registry is an in-memory RwLock<HashMap<String, BoxEgress>>.
  • crates/bep/src/boxes.rs:6: a box id that is not registered has no declared egress, so the proxy refuses every request from it as outside_declared_egress.
  • crates/bep/src/main.rs:1273: bep serve starts with BoxRegistry::default(), which is empty.
  • register_box is sent only on the creation path: crates/minimal/src/mint.rs:1663 and crates/minimal/src/cmd/boxes/create.rs:4496 and :4510. Attach and resume do not send it.
  • crates/minvmd/src/box_registry.rs:4041: after a restart send_live_boxes sends the box ids only.

The proxy already keeps client keys in a file across restarts (crates/bep/src/control.rs:108, from #2288). Box registrations have no equivalent. #2483 introduced the in-memory registry.

crates/bep/src/boxes.rs is the same in the earlier dev build, so this is not new in rc1. The upgrade was the first proxy restart in the box's life.

Expected

A kept box reaches the same proxy-served hosts after a proxy restart as before it, with no action from the user.

Possible fixes

  • minvmd re-registers each live box's egress when it starts the proxy. Its box-registry.json row already holds each box's egress and credentialed upstream settings.
  • Or the proxy persists registrations beside the client keys and reloads them at start.

Either way, a test should restart bep serve under a running box that holds a GitHub grant and assert that a request to a declared host is still admitted.

Workaround

None that keeps the box. No command re-registers an existing box. A new box created from the same project is registered with the running proxy, and it loses its hosts the same way at the next restart.


This is a residual of epic #1501 (BEP).

Activity

  1. added
    priority:must-have
    kind:bug
    release:0.8.0
    on Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:bugpriority:must-haverelease:0.8.0

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0