Skip to content

fix(posture-check): parse nft -j set elements without a "val" wrapper - #220

Merged
robercano merged 1 commit into
mainfrom
fix/posture-check-nft-json-parse
Aug 6, 2026
Merged

fix(posture-check): parse nft -j set elements without a "val" wrapper#220
robercano merged 1 commit into
mainfrom
fix/posture-check-nft-json-parse

Conversation

@robercano

Copy link
Copy Markdown
Owner

Problem

posture-check.sh's fence-coverage check parses nft -j list set output with
grep -oE '"val":[0-9]+'. On the nftables shipped with Ubuntu 26.04, plain set
elements serialize as "elem":[1001] — the {"val":...} wrapper only appears
when elements carry attributes (timeout, comment, counter). live_uids therefore
came back empty and the script raised "BusyBee: egress fence NOT LOADED" on
every run — an hourly false page — while nft list set inet recode_agent agent_uids showed the set loaded with uid 1001.

A tripwire that cries wolf hourly trains the operator to ignore the exact
channel that exists to make a silent failure noisy.

Fix

Take everything after "elem": and extract the numbers, which matches both
serializations. Found on the first manual posture-check run after installing the
registry-driven artifacts on the live box (BusyBee); the corrected script was
installed there and runs clean.

Verification

  • Live box, fence loaded: old parse → false "NOT LOADED" alert; new parse → silent pass, exit 0.
  • sudo -u recode-agent curl -sI https://api.github.com → HTTP/2 200; http://example.com → dropped + alarmed, confirming the fence itself was healthy throughout.

🤖 Generated with Claude Code

The fence-coverage check grepped nft's JSON for '"val":[0-9]+', but nft
prints plain set elements as "elem":[1001] -- the {"val":...} wrapper only
appears when elements carry attributes (timeout, comment, counter). On a
plain uid set live_uids therefore came back empty and every run paged
"egress fence NOT LOADED" while the fence was demonstrably loaded: a false
alarm, hourly, on the channel whose credibility the design depends on.

Caught on the first manual run after installing the registry-driven
artifacts on a live box. Pull the numbers from everything after "elem":
instead, which matches both serializations.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@robercano
robercano merged commit 1bbcdd0 into main Aug 6, 2026
9 checks passed
@robercano
robercano deleted the fix/posture-check-nft-json-parse branch August 6, 2026 11:56
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.

1 participant