Conversation
…released host Side finding SF-1 from PR-24 7-day passive soak (Day 6, 2026-04-26 on lab4 / AuthorityNone): `nftban health` rendered a spurious "ERROR: Script failed" block on top of its own DOWN-status table. Root cause: 4 unprotected call sites under set -Eeuo pipefail. nftban_health_cmd_truth() correctly captures the validator's exit code (2) internally and renders a clean DOWN table, but the bare invocations at the case-branch / dispatcher / top-level main fire the ERR trap defined in lib/strict.sh before the function's exit code can propagate cleanly. Fix: add `cmd || return $?` (or `|| exit $?` at top level) at: - cli/lib/nftban/cli/cmd_health.sh:140 — case check|""|truth|axes - cli/lib/nftban/cli/cmd_health.sh:189 — case json|--json - cli/sbin/nftban:917 — main() dispatch into nftban_cmd_<X> - cli/sbin/nftban:1261 — top-level `main "$@"` invocation The pattern is already documented inside nftban_health_cmd_truth itself (lines 413-421) for the same reason on the inner validator call. Exit-code semantics preserved: a released host now exits 2 cleanly, matching the rendered DOWN status, with no spurious trap output. Verified by local bash simulation: old pattern fires TRAP-FIRED on validator exit 2; new pattern propagates exit 2 cleanly with no trap output. Out of scope (locked): - Lifecycle execution surfaces untouched (restore/, state/file.go, uninstall_apply.go, etc.) - SF-2 stale FAILURE_REASON retained in state file — separate fix - Repo hygiene Phase A — separate (1.100.3+) - Lifecycle completion lane (PR-25..PR-30) — explicitly OPEN Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
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.
Summary
Closes side finding SF-1 logged during the PR-24 7-day passive soak (Day 6, 2026-04-26 on lab4 / AuthorityNone host).
`nftban health` rendered a spurious `ERROR: Script failed` block on top of its own DOWN-status output when run on a released/no-tables host (validator legitimately exits 2 with no nftban tables present).
Root cause
`nftban_health_cmd_truth()` correctly captures the validator's exit code (2) and renders a clean DOWN table before returning. However, 4 call sites under `set -Eeuo pipefail` did not protect bare invocations from the ERR trap defined in `lib/strict.sh`:
When the validator exited 2, each unprotected level fired the trap, printing `ERROR: Script failed` on top of the legitimate output — confusing operators and contradicting the in-table DOWN message.
Fix
Added the `cmd || return$?` (or `|| exit $ ?` at top level) idiom at all 4 sites.
The pattern was already documented and used inside `nftban_health_cmd_truth` itself (lines 413-421) for the same reason on the inner validator call:
Exit-code semantics preserved: a released host now exits 2 cleanly, matching the rendered `DOWN` status, with no spurious trap output.
Diff
3 files changed, 53 insertions(+), 5 deletions(-) — most of the diff is comments + CHANGELOG. The mechanical change is 4 small edits.
Verification
Local bash simulation reproduces the broken behaviour with the old pattern and confirms the new pattern propagates exit 2 cleanly:
```bash
Old: TRAP-FIRED printed on top of "DOWN table"
New: clean "DOWN table" then exit 2
```
Out of scope (locked per user 2026-04-27)
Test plan
🤖 Generated with Claude Code