fix: allowlist parent domain unblocks subdomains #74
Reference in New Issue
Block a user
Delete Branch "fix/allowlist-parent-unblocks"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
example.comnow unblockswww.example.comeven whenwww.example.comappears individually in the blocklistis_blockedrestored to zero-allocation hot path (callsfind_in_setdirectly instead of constructingBlockCheckResult)normalize()helper for domain lowercasing + trailing dot stripping (4 call sites)check,is_blocked,add_to_allowlist, andremove_from_allowlistis_blocked/checkvia sharedfind_in_sethelperRoot cause:
is_blockedchecked allowlist exact → blocklist exact → then interleaved allowlist/blocklist walk-up. The blocklist exact match onwww.example.comreturnedtruebefore reachingexample.comin the allowlist. Fix: check allowlist at all parent levels first, then blocklist.Test plan
cargo test --lib blocklist— 11 tests passmake all— 181 tests, clippy, fmt, audit all greenexample.comto allowlist, verifywww.example.comis unblocked via/blocking/check/www.example.comwww.example.comdoes NOT unblockads.example.com)example.com.) match correctly🤖 Generated with Claude Code