Skip to content

T74 — Decide a DNS box's destinations on the host from the answers its own queries received - #1811

Merged
norrietaylor merged 17 commits into
mainfrom
agent/1808-decide-a-dns-box-s-destinations-on-the-host-from
Oct 2, 2026
Merged

norrietaylor merged 17 commits into
mainfrom
agent/1808-decide-a-dns-box-s-destinations-on-the-host-from

Conversation

@minimal-foundry

@minimal-foundry minimal-foundry Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

T74 — Decide a DNS box's destinations on the host from the answers its own queries received

### T74 — Decide a DNS box's destinations on the host from the answers its own queries received
  slice: S9
  kind: task
  covers: NET-081, NET-066, NET-067
  size: L
  est: 520 code, 480 tests
  executor: agent
  difficulty: needs care
  model: strongest
  diagnostics: the bundle's VM host daemon log tail carries one line per box when its host-side admission table is first filled and one rate-limited line per refused resolved range, so a DNS box whose destination was decided on the host reads so in a bundle
  observability: one info log line per box at the first host-side pin, naming the box and the name; one rate-limited warn line per refused answer in the shared refusal format; a counter of frames the host gate admitted by a pin and refused for want of one
  layers:
    - vmhost:
      - crates/minvmd/src/net/dns_pins.rs (new): the host-side admission table, one per registered box, filled from the DNS replies the host switch returns toward the box's switch address for a name the box's row declares in allow_dns_hosts, so every pin is an answer the box's own query received and never a second resolution; the answers pass the sessions crate's rebinding intersection against the row's deny_subnets and the infrastructure deny set before entry; the window, the per-name address cap, the TTL floor and cap and the used-pin retention past the window are the ones the in-VM gate applies, read from the sessions crate so both legs hold one number; the table is bounded per box and dropped with the row
      - crates/minvmd/src/net/egress_gate.rs: the deferral arm is gone; a frame a DNS-resolving row would drop as an undeclared destination is decided on the host against that box's admission table, admitted when a live pin names the destination and dropped otherwise, with the in-VM pin table left as the precision copy; a DNS reply the switch returns toward a box is passed to the table on its way to the guest; the row's deny set, the infrastructure deny set, the protocol rule, the control surface and the unknown-source and undeclared-port drops are never deferred for any row
      - crates/minvmd/src/net.rs: hands the gate each registered row's allow_dns_hosts with the row and wires the table's lifetime to the row's
      test: cargo nextest run -p minvmd dns_box_undeclared_destination_decided_on_host
      test: cargo nextest run -p minvmd host_pins_are_the_answers_the_box_received
      test: cargo nextest run -p minvmd host_window_refuses_denied_and_infrastructure_ranges
      test: cargo nextest run -p minvmd hostile_relay_reaches_only_the_pinned_answers
      test: cargo nextest run -p minvmd host_side_rules_applied_outside_vm
    - daemon:
      - crates/minimald/src/net/dns_gate.rs: the module doc names the host-side table as the deciding copy on a VM-backed host and this one as the precision copy inside the VM; no behaviour change
      test: cargo nextest run -p minimald dns_pinned_admission_window
  produces:
    - crates/minvmd/src/net/dns_pins.rs
  consumes:
    - crates/minvmd/src/net/egress_gate.rs
    - crates/sessions/src/core/egress.rs
    - crates/minimald/src/net/dns_gate.rs
  proof: On a VM-backed host, a box that allows github.com by name reaches the addresses its own lookup returned and nothing else, decided outside the VM: with the in-VM relay replaced by a hostile one that carries the box's frames to any subnet, the host gate drops every destination the box's own answers did not pin, refuses an answer that resolved into the row's deny set or the infrastructure set, keeps applying every non-DNS rule to the row, and the bundle's host log shows the decision was the host's.
  depends on:
    - blocked by #1708
    - blocked by #1711

Covers NET-081, NET-066, NET-067 (docs/specs/18-spec-box-networking/18-spec-box-networking.md).

Scope. The guarantee holds per registered row. A box whose frames come from the switch address its row holds reaches only the addresses its own lookups returned, even when a hostile in-VM relay carries them. Frames from an allocatable address that no row holds are a separate case: while the unregistered-source phase stays Announced, they are admitted except to the infrastructure set. Closing that is #1790's job.

What changes

  • crates/minvmd/src/net/dns_pins.rs (new): the host-side DNS admission table, one entry per registered box that declared allow_dns_hosts. A reply pins only when all of the following hold:

    • it arrives on the switch→guest leg;
    • it comes from the row's resolver on port 53;
    • it answers one of the box's own outstanding queries, matched on transaction id, source port and question name. The egress leg records each query after the gate admits it. The record is bounded by DNS_OUTSTANDING_QUERY_CAP and DNS_QUERY_EXPIRY, and a match consumes it, so a replay pins nothing.

    Only A records on the answer chain pin: the walk starts at the question and follows CNAMEs, and the authority and additional sections are never read. AAAA, SVCB and HTTPS never pin.

    At intake, a row whose resolver is not the plan's host-side resolver gets no entry, and the refusal is logged once. A reply-shaped frame on the guest→switch leg is an egress-unknown-source drop and pins nothing.

    Answers pass sessions::core::egress::rebinding_intersection against the row's deny_subnets and the infrastructure set before entry. Each refused answer writes one rate-limited warn line naming the name, the answer and the rule.

    The window, the per-name cap, the used-pin retention and the per-box flow cap come from sessions::core::egress. Entries are retired with the relay connection that ends the row, and rebuilt fail-closed for a replacement row.

    Per-box flow cap. A box holds at most DNS_MAX_FLOWS_PER_BOX (4096) flows opened through its pins, and the cap is keyed per box, so one box at the cap never affects another's retention. At the cap:

    • flows idle past DNS_FLOW_IDLE_CAP are swept, at most once per second per box;
    • a new flow that still finds the table full is admitted by its window alone and is not retained, so past the window its frames take the gate's usual silent drop (NET-062);
    • flows recorded before the cap keep their retention;
    • a per-box at-cap counter moves, and one info line per box at most once per minute names the switch address, the namespace, the cap and the counter (minvmd's default filter is info, so it reaches a bundle's log tail).
  • crates/minvmd/src/net/egress_gate.rs: the deferral arm is gone. A DNS row's undeclared-destination drop is decided on the host: a live pin, or a flow a pin established, admits the frame; anything else drops it under egress-undeclared-subnet. For every row, the following are still decided before the pin arm:

    • the deny set
    • the infrastructure set
    • the protocol rule
    • the switch control surface
    • the unknown-source and undeclared-port drops

    The ingress leg is framed and every frame is passed through verbatim; DNS replies are read on the way. The gate counts frames admitted by a pin and frames refused for want of one.

  • crates/minvmd/src/net.rs / box_registry.rs: the row carries its allow_dns_hosts. The run path builds the table and hands it to the gate. The interim "deferred to the guest's gate" line is removed.

  • crates/sessions/src/core/egress.rs:

    • The shared DNS admission numbers live here: DNS_ADMISSION_WINDOW, DNS_MAX_ADDRESSES_PER_NAME, DNS_FLOW_IDLE_CAP, DNS_OUTSTANDING_QUERY_CAP, DNS_QUERY_EXPIRY and DNS_MAX_FLOWS_PER_BOX (host table only).
    • The infrastructure deny set gains 0.0.0.0/8, 224.0.0.0/4, 240.0.0.0/4 and 255.255.255.255/32.
    • The IPv6 half (::/128, ::1/128, ::ffff:0:0/96) is recorded for the IPv6 epoch. It decides nothing in v1.
  • crates/minimald/src/net/dns_gate.rs: reads the shared constants (same values) and documents itself as the in-VM precision copy. No behaviour change. It adds a test proving the completed infrastructure set refuses and logs on this leg too.

Files outside the plan's layers: are justified:

  • crates/sessions/src/core/egress.rs holds the shared constants the layer text requires.
  • crates/minvmd/src/box_registry.rs lets the row carry its declared names.
  • crates/minvmd/Cargo.toml and Cargo.lock add hickory-proto, the parser minimald already uses.

The admission window is the fixed 5 minutes both legs already used, not a TTL-derived window. The departure from design §5.3's proposed TTL floor and cap is recorded at the constant.

The pin and at-cap counters are maintained in every build. They are read only by tests for now: exposing them through minvmd's control surface needs a new control verb and is a follow-up.

Tests

line result
cargo nextest run -p minvmd dns_box_undeclared_destination_decided_on_host pass
cargo nextest run -p minvmd host_pins_are_the_answers_the_box_received pass
cargo nextest run -p minvmd host_window_refuses_denied_and_infrastructure_ranges pass
cargo nextest run -p minvmd hostile_relay_reaches_only_the_pinned_answers pass
cargo nextest run -p minvmd host_side_rules_applied_outside_vm pass
cargo nextest run -p minimald dns_pinned_admission_window pass

Beside the plan lines, the architecture review's conditions are proved by:

  • a_reply_forged_on_the_guest_side_pins_nothing
  • a_row_whose_resolver_is_not_the_plans_own_is_refused
  • only_a_reply_to_the_boxs_own_outstanding_query_pins (fails if the reply match stops consuming its query)
  • only_the_answers_chain_pins
  • the_flow_table_is_bounded_per_box (cap, per-box keying with a second box, at-cap counter, one info line per box per minute)
  • at_the_cap_one_sweep_per_second_reclaims_the_idle_flows (the sweep reclaims an idle flow and runs at most once per second per box)
  • host_window_refuses_this_host_multicast_broadcast_and_reserved_answers
  • a_closed_relay_connection_retires_the_pins_it_filled
  • a_replacement_row_inherits_neither_pins_nor_flows
  • minimald's this_host_and_multicast_answers_are_refused_and_logged

The NET-068 toolchain harness landed on main with #1771 (crates/minvmd/tests/egress_allowlist_integration.rs) and is this path's regression oracle.

Closes #1808

Two admission tables will hold a box's DNS pins, the host-side one
NET-081 adds and the in-VM one NET-066 shipped, and each is bounded by
the same three numbers: the window an answer holds for, the per-name
address cap, and the used-pin retention past the window. They move to
the sessions crate, beside the rebinding intersection that produces
what the window stores, so neither leg can drift from the other — a pin
cannot outlive its window on one leg while it lives on in the other,
and one name's cap cannot be a different grant on the two paths a
box's frames take.

The in-VM gate re-points its three constants there, and its module
doc now names the two tables and which copy decides: on a VM-backed
host the host-side table is the deciding one, filled from the DNS
replies the box's own lookups received, and the in-VM gate stays the
precision copy inside the VM.

Design §5.3's TTL floor (600 s) and cap (24 h) stay prose: neither
gate applies a TTL-bounded window, a departure the in-VM gate records
at its constant, and a dead constant would suggest otherwise.
… ran out

the coder's uncommitted work as it stood when its 7200s ran out

The coder was stopped at the end of its time with these changes
not committed. The runtime committed its working tree as it stood so
the work is kept: this commit is a snapshot, not a finished step, and
may not build or pass its tests.
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d787de53-e466-40c7-842c-9cb9bc4f1c1c

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
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

The interrupted snapshot left the gate's DNS table half-threaded: the
accept loop, the relay and the verdict all took the pins parameter,
but five test call sites never grew it; the first-pin flag was a
plain bool behind an entry shared by Arc, and the frame verdict
passed its row owned where the table borrows it.

The build also carried the failures the failed checks name. The
sessions constants introduced by the previous commit tripped
duration_suboptimal_units under the CI toolchain, which alone took
down every job that compiles the workspace; the registry's dns_hosts
read tripped map_clone; the gate's own public spawn exposed a
pub(crate) table type. And the window test's two count assertions
were written against a per-answer refusal key that contradicts both
this limiter's own doc and the in-VM bucket it shares: the shared
refusal format rates by box, name and rule, so a repeated answer
under a spent key is silent. The assertions now say so, and the
burst's silence is what they prove.

The two admission counters keep test-facing readers under
#[cfg(test)], the pattern the in-VM gate's window-shrinkers set:
the counter is table state, maintained at the decision in every
build, and no production surface reads a running total yet.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 1 of 10 on a failed check suite, pushed as b6d39bb90108.

line exit tail
cargo nextest run -p minvmd dns_box_undeclared_destination_decided_on_host 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-4307... Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/48d9b/tree/crates/ot) Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/48d9b/tree/crates/args) C
cargo nextest run -p minvmd host_pins_are_the_answers_the_box_received 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-805d... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/86922/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/86922/tree/crates/
cargo nextest run -p minvmd host_window_refuses_denied_and_infrastructure_ranges 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-e04d... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/b32a9/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/b32a9/tree/crates/
cargo nextest run -p minvmd hostile_relay_reaches_only_the_pinned_answers 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-10cd... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/f33fc/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/f33fc/tree/crates/
cargo nextest run -p minvmd host_side_rules_applied_outside_vm 0 Applying loadouts: default Running task runtime-implement-test-4 in session task-runtime-implement-test-4-160a... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/81535/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/81535/tree/crates/
cargo nextest run -p minimald dns_pinned_admission_window 0 Applying loadouts: default Running task runtime-implement-test-5 in session task-runtime-implement-test-5-7787... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/8ad7c/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/8ad7c/tree/crates/ot) C

Verify min task run agent-verify passed.

Outside the task's layers::

  • crates/minvmd/Cargo.toml
  • crates/minvmd/src/box_registry.rs
  • crates/sessions/src/core/egress.rs

Converted to a draft: something above needs a person before review.

On a VM-backed host, a box that allows github.com by name reaches the addresses its own lookup returned and nothing else, decided outside the VM: with the in-VM relay replaced by a hostile one that carries the box's frames to any subnet, the host gate drops every destination the box's own answers did not pin, refuses an answer that resolved into the row's deny set or the infrastructure set, keeps applying every non-DNS rule to the row, and the bundle's host log shows the decision was the host's — all four behaviours are now demonstrated by passing tests on this branch (dns_box_undeclared_destination_decided_on_host, host_pins_are_the_answers_the_box_received, hostile_relay_reaches_only_the_pinned_answers, host_window_refuses_denied_and_infrastructure_ranges, host_side_rules_applied_outside_vm, dns_pinned_admission_window). The NET-068 toolchain harness named as the regression oracle is not runnable here: hostname_allowlist_toolchain_completes lives only on PR #1771's branch (not on main, so not in this tree) and its real run is VM-lane gated; what this branch offers instead is that the in-VM leg it exercises (dns_gate.rs) carries only module-doc and constant re-pointing with unchanged values, and the frame-level tests above prove the host admits exactly the answers the box's own lookups produced.

Notes from the agent: Revise round for PR #1811: all four failed checks (ci-success, unit, native-daemon-e2e, clippy) traced to one root cause — the interrupted snapshot aa7ff9c did not compile (5 test call sites missing the new DnsPins argument, a borrow error at the pin arm, a field written behind &self, plus a lint set). This round finished the refactor and cleared the lints; the branch now builds, the six task tests pass, the unit lane's own nextest invocation passes 769 tests plus doctests, and clippy -D warnings is clean on minvmd, sessions, minimald and minimal. Two judgement calls to flag. (1) host_window_refuses_denied_and_infrastructure_ranges: the s…[truncated]

@norrietaylor

Copy link
Copy Markdown
Member

/revise

  1. In crates/minvmd/src/net/dns_pins.rs tests (and/or crates/minvmd/src/net/egress_gate.rs tests), add a test that pins the plan's "dropped with the row" lifetime of the host-side DNS admission table. It must fail if either pins.retire(&attributed) in relay_guest_to_switch or the Arc::ptr_eq(&entry.record, record) guard in DnsPins::entry is removed. Two cases: (a) after a box's own reply pins an address, DnsPins::retire(&[lease]) leaves that address refused for the same row (admits_frame false), and over a live gate, closing the box's relay connection has the same effect for a re-registered row at the same address; (b) a replacement row registered at the same switch address (a new BoxRecord, same allow_dns_hosts) holds none of the old row's pins or established flows until its own lookup pins again. Tests only; no production change; keep both new tests under the vmhost layer files.
  2. In crates/minvmd/src/net/dns_pins.rs DnsPins::observe_reply, return before table.by_source and before taking the boxes mutex unless pkt.src.port() == 53, so non-DNS ingress UDP never pays the table lookup or the lock. Leave the resolver-address and every other check in BoxPins::observe as they are. No behaviour change; the existing plan test lines must still pass unchanged.

observe_reply read every ingress datagram through the row lookup and
the table's lock before the port check refused it, so the answers to
a box's own non-DNS datagrams paid both for a reply that could never
pin. The port DNS is served from now turns the datagram away before
either: the same fact BoxPins::observe decides the reply's source by,
read once more where it is cheapest. No behaviour changes — the
resolver's address and every other check stay where they were.
The plan's "dropped with the row" now has a proof for each half.

The pure half pins the entry's identity guard: a replacement row at
the same switch address — a new record, the shape a re-attachment's
re-registration takes — inherits none of the replaced row's pins or
established flows, and the replaced record admits nothing either,
until the new row's own lookup pins again.

The relay half pins the retire the connection's end performs,
watched on a row the drainer has not withdrawn yet — the shape a
hostile relay would try: close the connection, keep the row, and
hope the pin outlives the close. It does not; the re-registered row
starts fail-closed too, and its own lookup is what pins again.

Both tests fail if the arm they watch is removed: dropping the
entry's identity check hands the replacement row the old entry's
pins, and dropping the relay's retire lets them ride the reopened
connection.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 2 of 10 on a /revise note, pushed as ef15c61b0039.

line exit tail
cargo nextest run -p minvmd dns_box_undeclared_destination_decided_on_host 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-dfae... Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/90c0d/tree/crates/ot) Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/90c0d/tree/crates/args) C
cargo nextest run -p minvmd host_pins_are_the_answers_the_box_received 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-af4f... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/44879/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/44879/tree/crates/
cargo nextest run -p minvmd host_window_refuses_denied_and_infrastructure_ranges 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-ef31... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/5c4b6/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/5c4b6/tree/crates/
cargo nextest run -p minvmd hostile_relay_reaches_only_the_pinned_answers 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-90d1... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/9aa0f/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/9aa0f/tree/crates/
cargo nextest run -p minvmd host_side_rules_applied_outside_vm 0 Applying loadouts: default Running task runtime-implement-test-4 in session task-runtime-implement-test-4-28e1... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/75253/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/75253/tree/crates/
cargo nextest run -p minimald dns_pinned_admission_window 0 Applying loadouts: default Running task runtime-implement-test-5 in session task-runtime-implement-test-5-2e2b... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/00416/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/00416/tree/crates/ot) C

Verify min task run agent-verify passed.

Outside the task's layers::

  • crates/minvmd/Cargo.toml
  • crates/minvmd/src/box_registry.rs
  • crates/sessions/src/core/egress.rs

Converted to a draft: something above needs a person before review.

On a VM-backed host, a box that allows github.com by name still reaches only the addresses its own lookup returned, decided outside the VM — and now the plan's promised lifetime is held by tests a person can read: a DNS box's host-side admission table is dropped with the row (a replacement row re-registered at the same switch address inherits none of the replaced row's pins or established flows, and the replaced record admits nothing either) and with the relay connection whose lookups filled it (closing the box's relay connection leaves its pinned destinations refused on the next connection, for the same still-published row, until its own lookups pin again) — and a box's non-DNS ingress UDP no longer pays the admission-table lookup or its lock, refused at the port DNS is served from before either.

Notes from the agent: Revise round 2 of the directive, two items, both addressed. Item 1 (tests only): a_replacement_row_inherits_neither_pins_nor_flows (dns_pins.rs, case b) and a_closed_relay_connection_retires_the_pins_it_filled (egress_gate.rs, case a) pin the 'dropped with the row' lifetime. Both sensitivities were verified by mutation and reverted: removing pins.retire(&attributed) in relay_guest_to_switch fails the relay test (the pinned frame reaches the switch where only the marker should), and removing the Arc::ptr_eq(&entry.record, record) guard in DnsPins::entry fails the replacement-row test. The relay test deliberately takes the withdrawal-report receiver without spawning the drainer, so the row stays published after the close and the retire is watched on the very record the entry was built from — the report the test waits for is filed only after the retire runs in relay_guest_to_switch. Item 2 (no behaviour change): observe_reply returns before table.by_source and before the boxes mutex unless pkt.src.port() == DNS_PORT; the resolver-address check and every other check in BoxPins::observe are untouched, and all six plan test lines pass unchanged…[truncated]

@norrietaylor

Copy link
Copy Markdown
Member

/revise

These are the architecture review's conditions on T74. They are binding, and they come on top of round 2's asks. Keep every change within this task's layers, plus crates/sessions/src/core/egress.rs for the shared constants.

  1. The pin table's single entrance stays outside the VM.
    • Add a test in crates/minvmd/src/net/dns_pins.rs or egress_gate.rs: a guest→switch frame shaped as a DNS reply from the row's resolver on port 53, for a declared name, pins nothing.
    • At row registration, in crates/minvmd/src/net.rs or the gate's row intake, assert that the row's resolver is the host-side helper's resolver address. Refuse a row whose resolver is anything else, whether an in-guest address or an upstream reached through NAT, and log the refusal. Otherwise the src == row.resolver check is spoofable.
    • Add a test that a row naming any other resolver is refused.
  2. Only the answer chain pins. In BoxPins::observe:
    • Start from the question name, follow CNAME records in the answer section, and pin only A records whose owner name is on that chain.
    • Ignore the authority and additional sections, and any answer record not on the chain.
    • AAAA, type 64 (SVCB) and type 65 (HTTPS) never pin.
    • Tests:
      • a reply carrying the real answer plus an unrelated A evil.example 1.2.3.4 pins only the real answer;
      • a CNAME chain name → alias → A pins the A;
      • an A owned by a name off the chain pins nothing;
      • an A in the additional section pins nothing.
  3. Pin only replies to the box's own outstanding query.
    • On the guest→switch leg, record each of the box's outstanding DNS queries to its resolver: question name, transaction id and source port.
    • Bound this per box (a small count and a short expiry, constants in sessions::core::egress).
    • observe pins only for a reply that matches an outstanding entry (same txid, same destination port as the query's source port, same question name), then clears that entry.
    • Unsolicited or mismatched replies still pass to the guest, unpinned.
    • Tests:
      • a well-formed reply for a declared name with no outstanding query pins nothing;
      • a reply with a mismatched txid pins nothing;
      • a matched reply pins and clears the entry, so a replay of the same reply pins nothing more.
  4. Scope the hostile-relay proof to registered rows. The unregistered-source phase is still Announced, so a relay sourcing from an unheld address is #1790's case and not this task's.
  5. Complete the infrastructure deny set. In the shared constant in crates/sessions/src/core/egress.rs, which both legs read, add:
    • 0.0.0.0/8 (a destination of 0.0.0.0 means this host, so it is loopback);
    • 224.0.0.0/4 (multicast);
    • 255.255.255.255/32 (broadcast);
    • 240.0.0.0/4 (reserved).
      Record ::/128 and ::ffff:0:0/96 beside ::1 in the IPv6 list, for the IPv6 epoch; AAAA still never pins in v1. Tests on both legs (minvmd host table and minimald dns_gate): an allowed name that answers 0.0.0.0 is refused and logged, and so is one that answers 224.0.0.1.

Add the four ranges the answer-side set was missing to the shared
constant both admission legs read: this-host space (0.0.0.0/8, where
0.0.0.0 names the host itself), multicast (224.0.0.0/4), broadcast
(255.255.255.255/32) and the reserved block it ends in (240.0.0.0/4).
Record the set's IPv6 half beside it for the IPv6 epoch — the
unspecified address, loopback and the IPv4-mapped space, a record v1
decides nothing with, since AAAA never pins. Hold the host leg's
reply-matching bounds here too: the outstanding-query cap and the
query expiry, named where the cross-leg numbers live.
The architecture review's conditions on the host-side admission table:

- The pin table's single entrance stays outside the VM. A row whose
  resolver is not the plan's own — the only shape a foreign resolver can
  take, a drift between the table's plan and the registry's — is refused
  its entry and says so once, naming both resolvers; and a reply-shaped
  frame on the guest→switch leg is decided like any other frame and pins
  nothing, proved at the relay by a forged reply wearing the resolver's
  own address: it never reaches the switch, and buys no reach.
- Only the answer chain pins. The chain starts at the question name and
  follows the CNAME records in the answer section; an A record pins
  exactly when its owner is on it. The authority and additional sections
  and every type but A — AAAA, SVCB, HTTPS — are read past.
- Only a reply to the box's own outstanding query pins. The egress leg
  records each query the gate admitted to the switch — question,
  transaction id, source port — under the shared cap and expiry the
  sessions crate now holds, and the reply must match all three to pin;
  the match consumes the entry, so a replay answers nothing.
- The hostile-relay proof is scoped to registered rows, naming #1790 as
  the owner of the unregistered-source case.
The precision copy's module doc now says what changed at the deciding
copy: the host-side table records each of the box's own outstanding
queries and a reply pins there only by answering one, consuming the
entry, and its entrance is closed where a reply-shaped frame on the
guest→switch leg is decided like any other frame. This gate keeps the
loose match it always had — no behaviour change — because it adds no
per-query state of its own and on a VM-backed host the reach a reply
buys is the host's decision to make.

And the completed infrastructure deny set is proved on this leg too:
an allowed name answering 0.0.0.0 or 224.0.0.1 is refused before the
answer can become a pin and each refusal is logged in the shared
format, while the connection to each stays the relay's drop.
…mes it

The hostile-relay proof was written as
hostile_relay_on_a_registered_row_reaches_only_pinned_answers, which the
task's test line - cargo nextest run -p minvmd
hostile_relay_reaches_only_the_pinned_answers - does not match as a
substring filter, so the runner's re-run found no tests and exited 4.
Rename the test to the name the plan's test command names; its
assertions are unchanged.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 3 of 10 on a /revise note, pushed as 09699914aaa1.

line exit tail
cargo nextest run -p minvmd dns_box_undeclared_destination_decided_on_host 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-aa10... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/a69cc/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/a69cc/tree/crates/ot) C
cargo nextest run -p minvmd host_pins_are_the_answers_the_box_received 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-22e6... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/a87d0/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/a87d0/tree/crates/
cargo nextest run -p minvmd host_window_refuses_denied_and_infrastructure_ranges 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-0623... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/559f5/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/559f5/tree/crates/
cargo nextest run -p minvmd hostile_relay_reaches_only_the_pinned_answers 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-a558... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/5016c/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/5016c/tree/crates/
cargo nextest run -p minvmd host_side_rules_applied_outside_vm 0 Applying loadouts: default Running task runtime-implement-test-4 in session task-runtime-implement-test-4-de57... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/6967e/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/6967e/tree/crates/
cargo nextest run -p minimald dns_pinned_admission_window 0 Applying loadouts: default Running task runtime-implement-test-5 in session task-runtime-implement-test-5-2076... Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/ca9e2/tree/crates/ot) Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/ca9e2/tree/crates/args) C

Verify min task run agent-verify passed.

Outside the task's layers::

  • crates/minvmd/Cargo.toml
  • crates/minvmd/src/box_registry.rs
  • crates/sessions/src/core/egress.rs

Converted to a draft: something above needs a person before review.

On a VM-backed host, a box that allows github.com by name reaches exactly the addresses its own outstanding queries received through the answer chain — decided outside the VM: the host gate records each DNS question the box asks and admits only replies that answer one (same name, transaction id and source port, the match consumed on use), so with the in-VM relay replaced by a hostile one a forged reply on the guest side, a reply to a question the box never asked, a replay of a matched reply, an answer record off the CNAME chain or in the authority/additional sections, an AAAA/SVCB/HTTPS hint, and an answer naming this-host, multicast, broadcast or reserved space all pin nothing and every destination the box's own answers did not pin stays the host's drop, each refusal logged in the shared format naming the box, the name, the answer and the rule.

Notes from the agent: All five directive items are done, each inside the task's layers plus the directive's added crates/sessions/src/core/egress.rs. (1) The entrance: item 1(b)'s resolver assertion lives in the gate's row intake, DnsPins::entry — the directive's other allowed site — so crates/minvmd/src/net.rs needed no change this round and is untouched; a row whose resolver is not the plan's own is refused its entry (nothing can ever pin for it) and logged once per row, and item 1(a) is proved at the relay by a_reply_forged_on_the_guest_side_pins_nothing, where a guest→switch frame wearing the resolver's address never reaches the switch and buys no reach. The egress leg's query recording is wired in relay_frames_to_switch after the admitted frame is written to the switch, so only questions the gate admitted to the switch are ever outstanding. (2) The chain walk is a single forward pass over the answer section in reply order — an A before its aliasing CNAME legitimately fails to pin, fail closed. (3) The outstanding-query cap (16) and expiry (30 s) are new constants in sessions::core::egress, named where the c…[truncated]

@norrietaylor

Copy link
Copy Markdown
Member

/revise Round 4.

Round 3's architecture conditions are met. Two items remain, both inside this task's layers plus crates/sessions/src/core/egress.rs for the shared constant. Do not change the in-VM gate's behaviour (crates/minimald/src/net/dns_gate.rs stays doc-only apart from the constant re-point it already has), and keep the plan's test names as they are.

  1. Bound the host flow table per box. In crates/minvmd/src/net/dns_pins.rs, BoxPins::admits inserts one FlowKey per new (proto, src port, dst, dst port) to a pinned destination. Nothing reclaims those entries for 24 h, so a hostile relay holding one pin can grow host minvmd memory without limit. The plan says the table is bounded per box.

    • Add DNS_MAX_FLOWS_PER_BOX (suggested 4096) to crates/sessions/src/core/egress.rs, beside the other DNS admission constants, with a doc line. Read it only from the host table.
    • In BoxPins::admits, before inserting a new flow: if the map is at the cap, first sweep the entries idle past DNS_FLOW_IDLE_CAP. If it is still at the cap, admit the frame by the window alone and do not retain the flow (fail closed at the window edge). Write one debug line naming the box and the cap. Existing flows keep refreshing as they do now.
    • Add a test in dns_pins.rs that fills the cap with distinct flows to a pinned address. It must show that the next new flow is still admitted inside the window and refused after DNS_ADMISSION_WINDOW, while a flow recorded before the cap is still admitted after the window.
  2. Make the replay assertion prove the consume. In only_a_reply_to_the_boxs_own_outstanding_query_pins (dns_pins.rs), the replay is observed at now + DNS_ADMISSION_WINDOW + 1s. That is past DNS_QUERY_EXPIRY, so the test also passes when the match does not consume its entry.

    • Replay the matched reply inside the query expiry (for example at now + 10s).
    • Then assert the destination is refused at now + DNS_ADMISSION_WINDOW + 1s. A replay that pinned would have refreshed the window past that instant.
    • The test must fail if .remove(&key) in BoxPins::observe is changed to .get(&key).

Do not edit the PR body; it is updated by hand.

BoxPins::admits inserted one FlowKey per new flow to a pinned
destination and nothing reclaimed an entry for 24 h, so a hostile relay
holding one pin could grow the host daemon's memory without limit. The
per-box bound now lives with the other DNS admission numbers in
sessions::core::egress (DNS_MAX_FLOWS_PER_BOX) and is read by the host
table alone, whose memory is the host's: at the cap the entries idle
past the shared idle cap are swept first, and a new flow that still
finds the table full is admitted by the window its first frame is
inside and not retained — fail closed at the window's edge, so its
retention ends with the window rather than past it, while every flow
already recorded keeps refreshing. The local FLOW_SWEEP_AT sweep is
gone: the map can no longer cross the cap, so the sweep runs there.
The replay in only_a_reply_to_the_boxs_own_outstanding_query_pins was
observed past DNS_QUERY_EXPIRY, so the refusal it asserted held by the
expiry even when the match did not consume its entry: the test passed
against a non-consuming get. The replay now arrives at now + 10s,
while the question is still outstanding, and the refusal is asserted
at now + DNS_ADMISSION_WINDOW + 1s, an instant a replay that pinned
would have pushed the window past: the test fails if .remove(&key) in
BoxPins::observe becomes .get(&key).
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 4 of 10 on a /revise note, pushed as 352dc9dda6b5.

line exit tail
cargo nextest run -p minvmd dns_box_undeclared_destination_decided_on_host 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-4270... Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/841f2/tree/crates/ot) Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/841f2/tree/crates/args) C
cargo nextest run -p minvmd host_pins_are_the_answers_the_box_received 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-5a52... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/f3f06/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/f3f06/tree/crates/
cargo nextest run -p minvmd host_window_refuses_denied_and_infrastructure_ranges 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-968f... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/660cb/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/660cb/tree/crates/
cargo nextest run -p minvmd hostile_relay_reaches_only_the_pinned_answers 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-8822... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/60aec/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/60aec/tree/crates/
cargo nextest run -p minvmd host_side_rules_applied_outside_vm 0 Applying loadouts: default Running task runtime-implement-test-4 in session task-runtime-implement-test-4-dc47... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/2db25/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/2db25/tree/crates/
cargo nextest run -p minimald dns_pinned_admission_window 0 Applying loadouts: default Running task runtime-implement-test-5 in session task-runtime-implement-test-5-7cca... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/28c20/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/28c20/tree/crates/ot) C

Verify min task run agent-verify passed.

Outside the task's layers::

  • crates/minvmd/Cargo.toml
  • crates/minvmd/src/box_registry.rs
  • crates/sessions/src/core/egress.rs

Converted to a draft: something above needs a person before review.

On a VM-backed host, a box that allows a name by egress.allow_dns_hosts reaches the addresses its own lookup returned and nothing else, decided outside the VM — and this round closes the two holes a reviewer found in that decision: a hostile relay holding one pin can no longer grow the host minvmd's memory one flow at a time (the box's flow table holds at most the shared DNS_MAX_FLOWS_PER_BOX flows; at the cap idle entries are swept and a new flow's frame rides the window alone with no retention, fail closed at the window's edge, while flows recorded before the cap keep their past-window retention), and a replay of a matched DNS reply inside the query expiry is now proved to pin nothing — the assertion fails if the reply match stops consuming its outstanding-query entry, so the consume the proof rests on is observable rather than assumed.

Notes from the agent: Round 4 directive, both items done. (1) Added DNS_MAX_FLOWS_PER_BOX (4096) to crates/sessions/src/core/egress.rs beside the other DNS admission constants — that file is outside the task's layers: file list, but the directive explicitly authorizes it ("plus crates/sessions/src/core/egress.rs for the shared constant"), and it is in the task's consumes: list. The cap is read only by the host table (crates/minvmd/src/net/dns_pins.rs), per the directive; the in-VM gate (crates/minimald/src/net/dns_gate.rs) is untouched and its test line passes unchanged. The local FLOW_SWEEP_AT sweep was removed: with the cap enforced before insert the map can no longer cross 4096 entries, so the old >4096 sweep was dead code; the idle sweep now runs at the cap before insert. The new test the_flow_table_is_bounded_per_box fills the cap with 4096 distinct flows to one pinned address and shows the next new flow admitted inside the window, refused after DNS_ADMISSION_WINDOW (no retention), while a flow recorded before the cap still admits past the window. (2) The replay in only_a_reply_to_the_boxs_own_outstanding_query_…[truncated]

@norrietaylor

Copy link
Copy Markdown
Member

/revise Round 5. The architecture review confirms both substitutions: refusals stay NET-062 silent drops, and at-cap state is an info line plus a counter. A status surface is a separate follow-up task.

These are the architecture review's conditions on round 4's flow cap ("admit by window, not retained" is confirmed). Scope: crates/minvmd/src/net/dns_pins.rs (and egress_gate.rs only if a test needs the relay), plus the constant in crates/sessions/src/core/egress.rs if you add one. Do not change the in-VM gate (crates/minimald/src/net/dns_gate.rs). Keep the plan's test names as they are. Refusals stay silent drops: NET-062 says a disallowed connection is dropped without a reset, so do not add RST or ICMP replies.

  1. Prove the cap is per box. The structure already keys the flow map per BoxPins; add the assertion. In the_flow_table_is_bounded_per_box, register a second DNS box at another lease that resolves the same name. After the first box has filled its cap, the second box opens a new flow through its own pin. Assert that this flow is still admitted at now + DNS_ADMISSION_WINDOW + 1s (it was retained), while the first box's past-cap flow is refused at that instant.

  2. Sweep at most once per second per box, never per packet. Today, at the cap, every frame of a flow that was not retained runs flows.retain(...) over the whole map (BoxPins::admits, the insert path). That costs about 16 µs per frame at 4096 entries and reclaims nothing under attack.

    • Keep the last sweep instant on the box, for example beside the map under the same mutex. At the cap, sweep only when at least one second has passed since the last sweep. Otherwise go straight to admit-by-window with no retention.
    • Add a test that ages one recorded flow past DNS_FLOW_IDLE_CAP while the box is at the cap. Show that the next new flow, arriving one second or more after the last sweep, is retained (the sweep freed a slot). Show that a second at-cap frame inside the same second does not sweep. A #[cfg(test)] sweep counter on the box is fine for this, like the existing admitted_by_pin readers.
  3. Make the at-cap state visible and rate-limited.

    • Add a per-box counter of frames admitted at the cap without retention. Use an AtomicU64 on BoxPins with a #[cfg(test)] reader, the same pattern as admitted_by_pin.
    • Replace the per-frame debug! with one info line per box at most once per 60 s while the box is at the cap. It names the switch address, the namespace, the cap and the counter's value. minvmd's default filter is info, so a debug line never reaches a bundle's log tail.
    • Extend the cap test to assert the counter moved, and that two at-cap frames in the same minute log once.
    • Exposing these counters in a status surface needs a new control verb in minimald-rpc. That is a follow-up, not this round.

Do not edit the PR body; it is updated by hand.

@minimal-foundry

Copy link
Copy Markdown
Contributor Author

That /revise was refused. could not start the coder: Error: there is no container instance that can be provided to this durable object. The round was given back, so /revise again is not counted against the cap — and a refusal here is usually a window that has closed by the time you read this.

Round 5 of 10 was not counted; #1808 carries the same sentence.

@norrietaylor

Copy link
Copy Markdown
Member

/revise Round 5. The architecture review confirms both substitutions: refusals stay NET-062 silent drops, and at-cap state is an info line plus a counter. A status surface is a separate follow-up task.

These are the architecture review's conditions on round 4's flow cap ("admit by window, not retained" is confirmed). Scope: crates/minvmd/src/net/dns_pins.rs (and egress_gate.rs only if a test needs the relay), plus the constant in crates/sessions/src/core/egress.rs if you add one. Do not change the in-VM gate (crates/minimald/src/net/dns_gate.rs). Keep the plan's test names as they are. Refusals stay silent drops: NET-062 says a disallowed connection is dropped without a reset, so do not add RST or ICMP replies.

  1. Prove the cap is per box. The structure already keys the flow map per BoxPins; add the assertion. In the_flow_table_is_bounded_per_box, register a second DNS box at another lease that resolves the same name. After the first box has filled its cap, the second box opens a new flow through its own pin. Assert that this flow is still admitted at now + DNS_ADMISSION_WINDOW + 1s (it was retained), while the first box's past-cap flow is refused at that instant.

  2. Sweep at most once per second per box, never per packet. Today, at the cap, every frame of a flow that was not retained runs flows.retain(...) over the whole map (BoxPins::admits, the insert path). That costs about 16 µs per frame at 4096 entries and reclaims nothing under attack.

    • Keep the last sweep instant on the box, for example beside the map under the same mutex. At the cap, sweep only when at least one second has passed since the last sweep. Otherwise go straight to admit-by-window with no retention.
    • Add a test that ages one recorded flow past DNS_FLOW_IDLE_CAP while the box is at the cap. Show that the next new flow, arriving one second or more after the last sweep, is retained (the sweep freed a slot). Show that a second at-cap frame inside the same second does not sweep. A #[cfg(test)] sweep counter on the box is fine for this, like the existing admitted_by_pin readers.
  3. Make the at-cap state visible and rate-limited.

    • Add a per-box counter of frames admitted at the cap without retention. Use an AtomicU64 on BoxPins with a #[cfg(test)] reader, the same pattern as admitted_by_pin.
    • Replace the per-frame debug! with one info line per box at most once per 60 s while the box is at the cap. It names the switch address, the namespace, the cap and the counter's value. minvmd's default filter is info, so a debug line never reaches a bundle's log tail.
    • Extend the cap test to assert the counter moved, and that two at-cap frames in the same minute log once.
    • Exposing these counters in a status surface needs a new control verb in minimald-rpc. That is a follow-up, not this round.

Do not edit the PR body; it is updated by hand.

The architecture review's three conditions on the flow cap, all in the
host-side admission table; the in-VM gate is untouched.

The cap is each box's own: the bounded-per-box test now registers a
second DNS box at another lease resolving the same name and proves its
flow is retained past the window while the first box's past-cap flow is
refused at the same instant.

The sweep at the cap now runs at most once per second per box, never
once per frame, so a hostile relay holding one pin cannot buy the
sweep's walk with every frame it sends. A new test ages one recorded
flow past the shared idle cap and proves the next second's sweep frees
a slot a new flow is retained in, while a second at-cap frame inside
the same second sweeps nothing; a test-facing per-box sweep counter is
what shows it, since a sweep that reclaims nothing leaves no other
trace.

The at-cap state is visible and rate-limited: a per-box counter of the
frames the cap admitted without retention, and the per-frame debug
line replaced with one info line per box per minute naming the box,
the cap and the count. minvmd's default filter is info, so a debug
line never reached a bundle's log tail; the state now does.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 5 of 10 on a /revise note, pushed as 700c63d45e88.

line exit tail
cargo nextest run -p minvmd dns_box_undeclared_destination_decided_on_host 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-e87e... Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/dce34/tree/crates/ot) Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/dce34/tree/crates/args) C
cargo nextest run -p minvmd host_pins_are_the_answers_the_box_received 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-fd60... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/49785/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/49785/tree/crates/
cargo nextest run -p minvmd host_window_refuses_denied_and_infrastructure_ranges 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-e7c5... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/a032e/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/a032e/tree/crates/
cargo nextest run -p minvmd hostile_relay_reaches_only_the_pinned_answers 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-1c3d... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/c6c8b/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/c6c8b/tree/crates/
cargo nextest run -p minvmd host_side_rules_applied_outside_vm 0 Applying loadouts: default Running task runtime-implement-test-4 in session task-runtime-implement-test-4-47f7... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/955ff/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/955ff/tree/crates/
cargo nextest run -p minimald dns_pinned_admission_window 0 Applying loadouts: default Running task runtime-implement-test-5 in session task-runtime-implement-test-5-0760... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/759cf/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/759cf/tree/crates/ot) C

Verify min task run agent-verify passed.

Outside the task's layers::

  • crates/minvmd/Cargo.toml
  • crates/minvmd/src/box_registry.rs
  • crates/sessions/src/core/egress.rs

Converted to a draft: something above needs a person before review.

On a VM-backed host a box that allows github.com by name still reaches only the addresses its own lookup returned, decided outside the VM, and after this round the deciding table's flow cap is provably each box's own: a second box at another lease keeps its retained flow past the window while the first box's past-cap flow is refused at the same instant, the cap's sweep runs at most once per second per box (never per frame, so a hostile relay cannot buy the sweep's walk), and a box at its cap now reads in the bundle's host log as one rate-limited info line naming its switch address, namespace, the cap and the count of frames admitted without retention, beside a per-box counter of the same.

Notes from the agent: Round 5 directive, all three items done in crates/minvmd/src/net/dns_pins.rs; one commit (033f2da). (1) Per-box cap: the_flow_table_is_bounded_per_box now registers a second DNS box at 100.64.0.10 resolving the same name and asserts its flow is retained at now+window+1s while the first box's past-cap flow is refused at that instant. (2) Sweep throttle: the last sweep instant lives on the box beside the flow map under the same mutex (new FlowTable struct); at the cap a sweep runs only when at least one second has passed since the last, otherwise the frame goes straight to admit-by-window without retention. New test at_the_cap_one_sweep_per_second_reclaims_the_idle_flows ages one recorded flow past DNS_FLOW_IDLE_CAP at the cap, shows the next second's sweep frees a slot the new flow is retained in (it rides past the window), and that a second at-cap frame inside the same second does not sweep — proved by a test-facing per-box sweep counter (AtomicU64 on BoxPins, #[cfg(test)] reader sweeps_of, maintained at the sweep in every build like the table's other counters, since a sweep that reclaims nothing leaves no other trace). (3) At-cap visibility: per-box AtomicU64 at_cap_admitted with #[cfg(test)] reader at_cap_admissions_of, and the per-frame debug!…[truncated]

@norrietaylor
norrietaylor marked this pull request as ready for review October 2, 2026 22:46
@norrietaylor
norrietaylor requested a review from a team as a code owner October 2, 2026 22:46
@minimal-foundry

minimal-foundry Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Approved: no findings at 700c63d45e88.

Nothing to do.

Verdict APPROVE, posted as a comment: the App cannot review its own pull request; the check and the label carry it.

Clobber: none: git log on the changed files shows only this branch's own feat/fix commits; the deferral-removal and set-completion are the PR's stated intent, and the one MEDIUM advisory in Cargo.lock (pageant, CVE-2026-102820) is pre-existing in the base, unrelated to the lockfile's only change (adding hickory-proto to minvmd's deps).

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor Author

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.

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

@norrietaylor norrietaylor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed at 700c63d: round-5 asks and the architecture conditions are met (per-box cap, swept table, counted admits, NET-062 silent drop); mutation checks fail as expected.

@norrietaylor
norrietaylor added this pull request to the merge queue Oct 2, 2026
Merged via the queue into main with commit 67cfaec Oct 2, 2026
34 checks passed
@norrietaylor
norrietaylor deleted the agent/1808-decide-a-dns-box-s-destinations-on-the-host-from branch October 2, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

T74 — Decide a DNS box's destinations on the host from the answers its own queries received

1 participant