fix(leak-guard): config-pattern (public IP) check now blocks + self-test #24
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/leak-guard-public-ip-block"
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?
Follow-up to #23. The guard's tailnet-IP and MagicDNS paths worked, but the configurable public-IP / domain path silently did not block — proven before the fix and after.
The bug
leak-guard.shCheck 3 ranload_config_patterns | while …; done. In POSIX sh the right side of a pipe is a subshell, soHAS_LEAK=1set there was lost: a public IP fromleak-patterns.conf(e.g. the OSA endpoint that started this whole thread) was printed but exited 0. Checks 1–2 avoided it by using a here-doc, not a pipe.Fix: read the config into a variable and iterate in the main shell.
Also in this PR
LEAK_GUARD_SKIP=1— the BLOCKED message advertised it; the script never checked it. Now it does.LEAK_PATTERNS_FILEoverride so the config path is testable.leak-patterns.conf,leak-guard-selftest.sh) — they hold detection patterns by design, so the guard would otherwise flag itself. Folded into aSCAN_EXCLUDESalongside the existing.forgejo/skip.scripts/leak-guard-selftest.sh— asserts all six paths incl. the public-IP regression, wired as a CI step before the diff scan. Fixtures use RFC5737 / CGNAT / a zeroed tailnet name, so the test file leaks nothing real.__probe_test__.md(placeholders + a "should block" comment but no real value — tested nothing) and the deadcheck_pattern().Verified locally
public IP from config blocks)--cachedmode blocks a staged tailnet IP (exit 1)Not in scope (wiring, needs the boxes)
freebsdrunner actually serves layered-soul — noleak-guardruns are recorded, and that runner was offline. Until a run goes green, don't make it a required check.git config core.hooksPath .githooks, or symlink). Worth a setup note/script so it isn't silently off.🤖 Generated with Claude Code