Repository navigation
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
Conversation
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.
…d-min-box-audit-reads-the-audit-record
The audit read and its test connect to the proxy's control socket, not the daemon, so the connection inventory records them as ungated.
Contributor
|
Important Review skippedBot 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.
|
Contributor
Spec lint
Advisory. None of this blocks the merge; the review decides. Advisory, and never a merge gate. Linter: |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up
Fixes #2463
crates/bep/src/control.rscrates/bep/src/main.rscrates/bep/src/audit.rscrates/minimal/src/mint.rscrates/minimal/src/cmd/box_audit.rscrates/minimal/src/tests.rscrates/minimal/src/cmd/doctor.rsdocs/specs/24-spec-box-egress-proxy/24-spec-box-egress-proxy.mdTask marker
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;topub(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 connectionsTests
cargo nextest run -p bep control_socket_streams_audit_records_for_one_subjectcargo nextest run -p bep control_socket_follows_audit_records_across_a_rotationcargo nextest run -p minimal box_audit_reads_over_the_proxy_socketcargo nextest run -p minimal box_audit_filters_to_one_boxcargo nextest run -p minimal box_audit_reads_over_the_proxy_socketVerify
min task run agent-verifyexited 100, so this PR is a draft.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.rscrates/minimal/src/tests.rsdocs/specs/24-spec-box-egress-proxy/24-spec-box-egress-proxy.mdOut of scope
These files are outside the task's
layers:, so this PR is a draft:crates/minimal/src/cmd/mod.rs