feat: deny-under-default-deny smell + judge ufw families apart - #44
Merged
Conversation
The mirror of allow-under-default-allow, closing the policy-vs-rules pair from the other side: under 'Default: deny (incoming)' a DENY rule with no allow below it refuses what the policy already refuses - it reads like extra hardening while doing nothing. Info severity, ufw only. Three exemptions, each measured on a real ufw 0.36 (Debian 13, privileged container): - a deny ABOVE an allow/LIMIT is spared: ufw is first-match, the deny carves an exception out of them - a REJECT under a deny policy is spared: the policy drops silently, the rule answers with a reset - a different, observable refusal. Roles swap under 'default reject' (then rejects are the no-ops) - a '(log)' deny is spared: it changes what you SEE even when it cannot change the verdict (measured: ufw appends ' (log)' to the From column) And the fix the new smell forced on its older mirror: ufw prints the whole IPv6 block after the IPv4 rules in ONE flat list, but the stacks are separate universes - a v6 allow 'below' a v4 deny can neither save it nor be shadowed by it (measured: a deny added after 'ufw allow 80' sat above the v6 block and the flat logic called it functional when it was dead). Both smells now partition by family (shared ufwFamilyPartitions) before judging positions. New sample ufw-default-deny-noop.txt captured from the real ufw: six rules, exactly one dead - the host-scoped deny somebody added AFTER the allow that shadows it. 39 smells, tests 174 -> 185. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What
deny-under-default-deny(info, ufw only) — the mirror of v1.27'sallow-under-default-allow, closing the policy-vs-rules pair from the other side: underDefault: deny (incoming), a DENY rule with no allow below it refuses what the policy already refuses. It reads like extra hardening ("I blocked telnet!") while doing nothing — the silent-no-op family.Exemptions (each measured on a real ufw 0.36, Debian 13)
default reject(then the rejects are the no-ops and denies do real work) — pinned by test.(log)deny is spared — it changes what you see even when it cannot change the verdict. Measured: ufw renders it as(log)appended to the From column.The fix the new smell forced on its older mirror
ufw prints the whole IPv6 block after the IPv4 rules in one flat list, but the two stacks are separate universes. Measured: a deny added after
ufw allow 80sits above the v6 block, and the flat-list logic called it functional when it was dead — and symmetrically, a trailing v6 deny could "save" v4 no-op allows in the v1.27 smell. Both smells now partition by family (sharedufwFamilyPartitions) before judging positions; regression tests pin both directions.Sample
ufw-default-deny-noop.txt, captured from the real ufw: six rules, exactly one dead — the host-scoped deny somebody added after the allow that shadows it (with the LIMIT, REJECT, and (log) rows correctly spared).39 smells, tests 174 → 185. Footer/package/README counters bumped in the same PR.
🤖 Generated with Claude Code