8000 fix(bep,minimal): un-enrolled, min box audit reads the audit records over the proxy's control socket by minimal-foundry[bot] · Pull Request #3701 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(bep,minimal): un-enrolled, min box audit reads the audit records over the proxy's control socket - #3701

Draft
minimal-foundry[bot] wants to merge 5 commits into
mainfrom
agent/2463-un-enrolled-min-box-audit-reads-the-audit-record
Draft

minimal-foundry[bot] wants to merge 5 commits into
mainfrom
agent/2463-un-enrolled-min-box-audit-reads-the-audit-record

Conversation

@minimal-foundry
Copy link
Copy Markdown
Contributor

Follow-up

Fixes #2463

Task marker
### D2463 — Un-enrolled, min box audit reads the audit records over the proxy's control socket and no longer opens the log files
  kind: task
  size: L
  est: 320 code, 220 tests
  executor: agent
  origin: residual
  epic: 1501
  layers:
    - proxy:
      - crates/bep/src/control.rs: adds a read_audit op that streams the retained records for the given subjects through LogReader, with a follow mode that tails until the client closes, and documents it
      - crates/bep/src/main.rs: gives the control socket the audit log directory in Wiring::control, so bep serve answers read_audit
      - crates/bep/src/audit.rs: removes the interim comments on default_dir and LogReader that name the client file read and issues 2459 and 2463
      test: cargo nextest run -p bep control_socket_streams_audit_records_for_one_subject
      test: cargo nextest run -p bep control_socket_follows_audit_records_across_a_rotation
    - client:
      - crates/minimal/src/mint.rs: adds a ControlClient method that sends read_audit and gives back the record lines, once or as a follow stream
      - crates/minimal/src/cmd/box_audit.rs: reads the records over the control socket at mint::control_path in place of bep::audit::default_dir, and drops the interim comments
      - crates/minimal/src/tests.rs: adds a test where a served Control with an audit log answers min box audit for a reaped box id, and the client opens no log file
      - crates/minimal/src/cmd/doctor.rs: rewords the interim comment that says the read is the same as min box audit, because doctor keeps the file read for its chain check
      test: cargo nextest run -p minimal box_audit_reads_over_the_proxy_socket
      test: cargo nextest run -p minimal box_audit_filters_to_one_box
    - spec:
      - docs/specs/24-spec-box-egress-proxy/24-spec-box-egress-proxy.md: adds a BEP-042 requirement for the read over the helper's local UDS and removes the comment that names the file read as the v1 path
      test: cargo nextest run -p minimal box_audit_reads_over_the_proxy_socket
  proof: On an un-enrolled host, min box audit <box-id> shows the records that bep serve wrote for that box, a reaped box included. The client reads them over the control socket and opens nothing under ~/.minimal/bep/audit.

Proof

On an un-enrolled host, min box audit connects to ~/.minimal/bep/control.sock and shows the records that bep serve wrote for that box, a reaped box included. bep serve reads its own log segments and sends only that box's records. The client is given only the socket path and opens nothing under ~/.minimal/bep/audit. --follow tails over the same connection, across a log rotation.

Notes from the agent: Outside the layers: crates/minimal/src/cmd/mod.rs changes one line, mod box_audit; to pub(crate) mod box_audit;. Without it, the new test in crates/minimal/src/tests.rs cannot call box_audit::run.

Protocol: {"op":"read_audit","subjects":[...],"follow":bool}. The proxy replies with one {"ok":true,"record":""} for each matching record. A {"ok":true,"caught_up":true,"skipped":N} line ends each read, and it carries no_log when the log directory does not exist. A follow ends when the client closes the connection or sends another line. A socket with no audit dir refuses the read. Wiring::control takes the audit dir as a new parameter, and the three main.rs tests pass a path next to their socket.

The box_audit.rs tests now run over a served Control (run_to_strings). Only box_audit_follow_replays_then_tails still reads files: it uses a test-only AuditSource impl for LogReader so it can step the writer between reads. Product code no longer reads the files.

Printed text changed. With no log directory, the command now says "The proxy has not written an audit log yet, so no records for box are shown." The skipped-line message no longer names a directory: "The audit log has N line(s) that ...". There are new errors for a proxy that does not answer,…[truncated]

Commit bodies re-wrapped by the runtime: a prose line over commitlint's 100 is split at a space where no piece is left over it, and code and lines that cannot split are left as written. Every word the coder wrote is kept, in order:

  • test(minimal): classify the box audit control socket connections

Tests

line exit tail
cargo nextest run -p bep control_socket_streams_audit_records_for_one_subject 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep control_socket_follows_audit_records_across_a_rotation 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p minimal box_audit_reads_over_the_proxy_socket 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p minimal box_audit_filters_to_one_box 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p minimal box_audit_reads_over_the_proxy_socket 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt

Verify

min task run agent-verify exited 100, so this PR is a draft.

1) minimal::bin/min tests::invalid_project_file_for_box_spec_says_spec_cannot_show
        PASS [   0.011s] (1536/1561) minimal::bin/min tests::invalid_project_file_prints_toml_error_once
        PASS [   0.010s] (1537/1561) minimal::bin/min tests::invalid_project_file_prints_toml_error_once_for_io
        PASS [   0.010s] (1538/1561) minimal::bin/min tests::loadout_not_found_exits_4
        PASS [   0.011s] (1539/1561) minimal::bin/min tests::local_host_not_found_exits_4
        PASS [   0.009s] (1540/1561) minimal::bin/min tests::machine_mode_answers_write_failures
        PASS [   0.010s] (1541/1561) minimal::bin/min tests::machine_mode_error_line_keeps_an_empty_hint
        PASS [   0.009s] (1542/1561) minimal::bin/min tests::machine_mode_error_object_is_one_stamped_line
        PASS [   2.079s] (1543/1561) minimal::named_vm named_vm_reaches_autospawn
        PASS [   0.017s] (1544/1561) minimal::bin/min tests::machine_mode_error_object_on_stderr
        PASS [   0.009s] (1545/1561) minimal::bin/min tests::machine_output_mode_keys_on_the_output_flag
        PASS [   0.014s] (1546/1561) minimal::bin/min tests::machine_mode_names_the_grant_refusal_code
        PASS [   0.008s] (1547/1561) minimal::bin/min tests::project_file_not_found_exits_4
        PASS [   0.014s] (1548/1561) minimal::bin/min tests::network_flag_refusal_exits_2
        PASS [   0.016s] (1549/1561) minimal::bin/min tests::misplaced_run_flag_exits_2
        PASS [   0.009s] (1550/1561) minimal::bin/min tests::prune_off_tty_needs_yes_exits_2
        PASS [   0.010s] (1551/1561) minimal::bin/min tests::resume_and_session_attach_refusals_map_to_exit_codes
        PASS [   0.010s] (1552/1561) minimal::bin/min tests::row_not_back_exit_codes
        PASS [   0.015s] (1553/1561) minimal::bin/min tests::rm_running_box_refuses_naming_force_with_exit_2
        PASS [   0.011s] (1554/1561) minimal::bin/min tests::run_verbs_and_wait_timeout_return_124_with_code_timeout
        PASS [   0.009s] (1555/1561) minimal::bin/min tests::start_entry_refusals_exit_with_their_codes
        PASS [   0.010s] (1556/1561) minimal::bin/min tests::task_file_invalid_exits_3
        PASS [   0.009s] (1557/1561) minimal::bin/min tests::task_not_found_exits_4
        PASS [   0.009s] (1558/1561) minimal::bin/min tests::task_run_is_a_stdout_contract
        PASS [   0.015s] (1559/1561) minimal::bin/min tests::task_network_key_a_task_does_not_apply_exits_3
        PASS [   0.008s] (1560/1561) minimal::bin/min tests::type_refusals_exit_3_and_4
  stdout ───

    running 1 test
    test exec_run_attach_and_task_run_share_the_commands_trace ... FAILED

    failures:

    failures:
        exec_run_attach_and_task_run_share_the_commands_trace

    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 5 filtered out; finished in 13.79s

  stderr ───

    ]
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 
────────────
error: test run failed

Base

The base branch moved while the coder worked and was merged in before the tests ran. These files changed on BOTH sides since the branch point — read them first, because a rewrite from a stale reading can undo a merge without a conflict:

  • crates/minimal/src/cmd/mod.rs
  • crates/minimal/src/tests.rs
  • docs/specs/24-spec-box-egress-proxy/24-spec-box-egress-proxy.md

Out of scope

These files are outside the task's layers:, so this PR is a draft:

  • crates/minimal/src/cmd/mod.rs

The control socket takes read_audit, which streams the retained records
for the named boxes through LogReader, and with follow tails the log
until the client closes. bep serve gives the socket its audit directory.
ControlClient sends read_audit and gives back the record lines, once
or as a follow stream. min box audit reads at mint::control_path in
place of the log directory, so it opens no audit log file.
The audit read and its test connect to the proxy's control socket, not the daemon, so the connection
inventory records them as ungated.
@coderabbitai
coderabbitai Bot commented Nov 20, 2026
Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

Ask an organization administrator to verify that this bot has an active assigned CodeRabbit review seat. See the seat-assignment guide. After the seat is confirmed, request a review again.

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: Advanced
  • Run ID: 2fdf7981-3405-4fef-9c18-cadb1baedb0f

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

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

@github-actions
Copy link
Copy Markdown
Contributor

Spec lint

docs/specs/24-spec-box-egress-proxy/24-spec-box-egress-proxy.md — 8 finding(s)

docs/specs/24-spec-box-egress-proxy/24-spec-box-egress-proxy.md:123: P004 BEP-003 names test 'bep_second_box_needs_no_sign_in', which was not found in the repository
docs/specs/24-spec-box-egress-proxy/24-spec-box-egress-proxy.md:180: P004 BEP-007 names test 'bep_box_env_holds_sealed_value_only', which was not found in the repository
docs/specs/24-spec-box-egress-proxy/24-spec-box-egress-proxy.md:228: P004 BEP-011 names test 'bep_root_ca_present_in_box_trust_store', which was not found in the repository
docs/specs/24-spec-box-egress-proxy/24-spec-box-egress-proxy.md:244: P004 BEP-012 names test 'bep_proxy_env_and_no_proxy_are_set', which was not found in the repository
docs/specs/24-spec-box-egress-proxy/24-spec-box-egress-proxy.md:357: P004 BEP-015 names test 'bep_git_and_gh_against_private_repo', which was not found in the repository
docs/specs/24-spec-box-egress-proxy/24-spec-box-egress-proxy.md:477: P004 BEP-087 names test 'bep_host_ip_git_and_gh_under_dns_steering', which was not found in the repository
docs/specs/24-spec-box-egress-proxy/24-spec-box-egress-proxy.md:796: P004 BEP-043 names test 'bep_destroyed_box_values_refused_within_60s', which was not found in the repository
docs/specs/24-spec-box-egress-proxy/24-spec-box-egress-proxy.md:805: P004 BEP-044 names test 'bep_logout_refuses_every_reference_at_next_request', which was not found in the repository

Advisory. None of this blocks the merge; the review decides.

Advisory, and never a merge gate. Linter: gominimal/foundry@8acb0663, spec format: How Minimal Writes Specs.

This branch has not been deployed

No deployments
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.

Serve the un-enrolled min box audit read over the proxy's local UDS (spec 24 task from arch#137)

0 participants

< 2C26 /div>
0