8000 fix(classifier): an nft that refuses before reading its script still reports what it said by bryan-minimal · Pull Request #3289 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(classifier): an nft that refuses before reading its script still reports what it said - #3289

Merged
bryan-minimal merged 2 commits into
mainfrom
fix/nft-refusal-before-read
Nov 13, 2026
Merged

bryan-minimal merged 2 commits into
mainfrom
fix/nft-refusal-before-read

Conversation

@bryan-minimal
Copy link
Copy Markdown
Member

run_nft_script wrote the whole script to nft's stdin and returned the write's error first. An nft that exits on its first lines leaves the write in EPIPE, so the error read Broken pipe (os error 32) and nft's own words (the refusal, the exit status) were lost. The unit test that drives a refusing stand-in lost that race once in 213 Linux CI-mirror runs and once on a Lima host (noted in #3256's verification as a pre-existing flake), each time as host_ip_lookup_outside_a_steered_box_resolves_real_fence_admits_only_the_box_leaf failing on Broken pipe.

The write now tolerates EPIPE and the error carries nft's stderr and exit status as before. An nft that exits 0 without reading its whole script is an error of its own (exited 0 before reading its whole script), not a success. The test makes the early exit certain with a script past the pipe's buffer and covers the exit-0 case, so the race is no longer a race.

Lab: the full CI mirror on Linux passes at this tree, and the baseline and the host_ip egress scenario hold on Ubuntu 24.04 and Fedora against the current release.

🤖 Generated with Claude Code

…reports what it said

`run_nft_script` wrote the whole script to nft's stdin and returned the
write's error first. An nft that exits on its first lines leaves the
write in EPIPE, so the error read `Broken pipe (os error 32)` and nft's
own words were lost; the unit test that drives a refusing stand-in lost
that race once in 213 lab runs and once on a Lima host. The write now
tolerates EPIPE and the error carries nft's stderr and exit status as
before; an nft that exits 0 without reading its whole script is an error
of its own, not a success. The test makes the early exit certain with a
script past the pipe's buffer, and covers the exit-0 case.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@coderabbitai
coderabbitai Bot commented Nov 11, 2026 •
Copy link
Copy Markdown
Contributor

Warning

Review limit reached

  • Run on-demand review

This review includes 1 billable file and costs up to $0.25.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 59 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

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: 74dc4bb3-cd19-4f9d-80b5-0bedd4f68f52
Commits

Reviewing files that changed from the base of the PR and between de6a590 and 318e11e.

Files selected for processing: 1

  • crates/minimald/src/net/classifier.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@bryan-minimal
bryan-minimal marked this pull request as ready for review November 11, 2026 20:16
@bryan-minimal
bryan-minimal requested a review from a team as a code owner November 11, 2026 20:16
@minimal-foundry
minimal-foundry Bot commented Nov 11, 2026 •
Copy link
Copy Markdown
Contributor

Reviewed: no findings; approval withheld, 1 thread unresolved at 318e11efb1bf.

APPROVE withheld: 1 unresolved thread — norrietaylor crates/minimald/src/net/classifier.rs. Resolving the last thread releases the approval on this head.

Resolve the open threads. Resolving the last one releases the approval on this head; no new review is required.

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 Nov 11, 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.

Scope matches the title. The change touches one function, run_nft_script, and its existing unit test. Clobber none. git log on classifier.rs shows that the recent fixes (#3240, #3187, #3179) touch other code, and the diff keeps them. Correctness The BrokenPipe arm now records unread and falls through to wait_with_output. A refusing nft still reports its stderr and exit status, and a different write error still returns at once. The new test is a true regression test. A 200 KB script is past the 64 KB pipe buffer, so write_all must hit EPIPE after the stand-in exits. Without the fix, the error is Broken pipe and the no such table assert fails. The silent case is also deterministic for the same reason. Rust ignores SIGPIPE in the test binary, so the write returns EPIPE and the process does not die. The unread check fires only when the write itself fails. A production fence script is a few hundred bytes and fits in the pipe buffer, so an nft that exits 0 without reading it still counts as a success. The code comment at 774-776 claims more than that, but nothing reaches the case. A pre-existing point that is outside this fix: write_all runs outside TABLE_LIST_DEADLINE. The sibling run_guest_child_bounded (classifier.rs:2628) bounds the write for that reason. With the current small scripts the write cannot block, so this is not a finding. Pattern: bep/src/store.rs:895 already tolerates BrokenPipe in the same way. No other nft stdin writer in the repo has the same race. Not checked: a test run, because the review rules allow no build.

Comment thread crates/minimald/src/net/classifier.rs Outdated

// An nft that refuses before reading its whole script (the write ends in EPIPE, which won the
// race over its stderr once in 213 lab runs and once on a Lima host) still reports what it said.
// A script past the pipe's buffer makes the early exit certain.
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.

nit · This test comment tells the flake history of this PR ("once in 213 lab runs and once on a Lima host"). That history belongs in the commit message. Keep the part that explains the test: a script past the pipe's buffer makes nft exit before it reads the script, and the write then ends in EPIPE.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Trimmed in 318e11e: the comment keeps the mechanism (a script past the pipe's buffer makes nft exit before it reads it, so the write ends in EPIPE) and the history is in the commit.

The comment on the early-exit case told this change's own history (where
the race was seen) rather than what the test proves; the history is in
the commit that added it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@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 — approval withheld

Verdict COMMENT — APPROVE withheld: 1 unresolved thread — norrietaylor crates/minimald/src/net/classifier.rs. No findings.

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

@minimal-foundry minimal-foundry Bot removed the review:approved minimal-review approved the current head label Nov 13, 2026
@bryan-minimal
bryan-minimal added this pull request to the merge queue Nov 13, 2026
Merged via the queue into main with commit 1a5ec4e Nov 13, 2026
39 checks passed
@bryan-minimal
8269 bryan-minimal deleted the fix/nft-refusal-before-read branch November 13, 2026 05:18
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.

2 participants

0