Repository navigation
Trim dead code, unused re-exports and near-copies (lean audit) - #199
Merged
Merged
Conversation
The flag exempted root only in filter_out, so root's TCP and DNS still went through Tor while its UDP left in cleartext. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com>
A start that could not read its table back recorded None, and the watchdog then skipped the #80 comparison for the whole session, so a flushed table passed. Start now rolls back; the watchdog treats a missing fingerprint or an unreadable table as a firewall failure. The chain-name and bypass-rule checks, which the fingerprint covers, are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com>
do_stop deleted the lock in a finally even when destroy_rules failed, so status and stop lost a session whose table was still loaded. It now keeps the lock and exits 8. A failed DNS restore exits 1 instead of 0, and a conntrack flush timeout no longer aborts the teardown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com>
transport_expressions (the guard's JSON) and transport_rules (TTP's nft text) are written apart, and nothing compared them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com>
Nothing reads them since watchdog status asks the live unit; they only cost a lock rewrite on every watchdog start and stop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com>
Only a lock without session_id reached it, i.e. one written by 0.4.x and still in /run after an upgrade mid-session. Every 0.5 session was already refused with 'Session Already Present' and ended by 'ttp stop', which also handles an old lock. The docs promising auto-recovery after kill -9 were wrong for 0.5 and are corrected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com>
Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com> # Conflicts: # docs/architecture.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com>
state.py re-exported the star-message helpers and PERSISTENT_DIR 'for backward compatibility'; only start, uninstall and one test used them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com>
restart redeclared all 17 of start's options and forwarded each by name; nothing kept the two lists equal. It now takes start's signature minus --require-vpn and forwards what it gets. `ttp restart --help` is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com>
start verifies through ttp.probe.verify_session; verify_tor had only its own tests. get_exit_ip now reads netprobe.ENDPOINTS, so the endpoint list exists once instead of twice plus a test keeping the copies equal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com>
_unit_state was called only by its tests, DeliveryState by nothing, and EXIT_UNVERIFIED duplicated ExitCode.UNVERIFIED for two test modules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com>
ttp.cli kept eleven `_name = name` aliases no test or script refers to; only _setup_logging is patched. ttp.watchdog re-exposed stdlib and ttp modules "for test mocks" that no test patches through it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com>
block_doh went through four functions and their docstrings, but nothing in TTP ever set it to False; only tests did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com>
apply_rules returns the UID it exempted, and start records that one in the lock, instead of resolving the name a second time behind an `except Exception: pass` that production could not reach. The Tor account names lived in four lists. tor_detect.TOR_ACCOUNTS is now the only one; the teardown and BYOD fallbacks also try toranon and _tor, and try debian-tor before tor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com>
semanage's add-then-modify, the four localhost bind probes, and systemd-resolved's restart-and-flush were each written out twice. Same calls, same order, same log levels. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com>
Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.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.
Implements findings 1–7 of the lean audit. No behaviour change except the one noted under 6.
restarttakesstart's options instead of a hand-kept copy of all 17 (it getsstart's signature minus--require-vpn).ttp restart --helpis byte-identical.tor_control.verify_torremoved — nothing called it;startverifies throughprobe.verify_session.get_exit_ipnow readsnetprobe.ENDPOINTS, so the endpoint list exists once.watchdog.service._unit_state,evidence.DeliveryState,_common.EXIT_UNVERIFIED(tests useExitCode.UNVERIFIED).ttp/cli.py(11 of 12;_setup_loggingstays, tests patch it) andttp/watchdog/__init__.py(stdlib and ttp modules no test patched through it).block_dohremoved — passed through four functions, neverFalseoutside tests. The DoH map is unconditional, as it already was in practice.firewall.apply_rulesreturns the UID it exempted andstartrecords it, replacing a second lookup behind an unreachableexcept Exception: pass. The Tor account names now live intor_detect.TOR_ACCOUNTSonly. Behaviour change: the teardown and BYOD fallbacks also trytoranonand_tor, and trydebian-torbeforetor(changelog entry added).Net: +142 / -637 lines (-495). Full unit suite passes locally (1823 tests).
🤖 Generated with Claude Code