Tests never reach the network (netguard) #30
Loading…
Reference in a new issue
No description provided.
Delete branch "oss-oo/test-netguard"
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?
Port of the test network guard from cinnamon-claude-usage (Claudiu: „dann sehr gerne auch in den andern beiden nachpflegen"), hardened in three review rounds; the guard and test files are identical in all three repos apart from the variable name.
make checkruns the Python suites withZ_USAGE_TEST_NETGUARD=1 PYTHONPATH="$(CURDIR)/tests/netguard". Name lookups (getaddrinfo,gethostbyname*,gethostbyaddr,getnameinfo) andconnect/connect_ex/sendtobeyond loopback raiseNetworkBlocked, aBaseExceptionnoexcept OSErrorcan swallow; proxies are bypassed (NO_PROXY=*), since a loopback proxy carried requests past the checks; onlylocalhostpasses by name; Python children that inherit the environment are guarded too.tests/test_netguard.pyproves every lookup is the guard's wrapper before calling it, probes connect/sendto on closed sockets, checks the loopback decision first, lets its child prove the guard before its lookup ofexample.invalid, and fails (instead of skipping) when the guard is only half set up.Reviews: a fresh read-only reviewer, three rounds (round 1: 2–3 should-fix + nits, round 2: one should-fix + 2 nits, round 3: one nit), every finding fixed; experiments in round 3 ran in an isolated network namespace. Test-only change: payload, installer and package unchanged, so no release or live sync.
🤖 Generated with Claude Code