Skip to content

Fix the repository audit's findings - #198

Merged
onyks-os merged 9 commits into
mainfrom
fix/audit-findings
Nov 30, 2026
Merged

onyks-os merged 9 commits into
mainfrom
fix/audit-findings

Conversation

@onyks-os

Copy link
Copy Markdown
Owner

Fixes the ten findings of the 2026-11-30 repository audit, one commit each.

Fixed

  • Missing table fingerprint turned off the A flushed inet ttp table passes the watchdog's integrity check: everything leaks, undetected #80 check. If nft could not list the table at ttp start, the lock recorded None and the watchdog skipped the comparison for the whole session. A flushed table keeps its chain names, so it then 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; a bypass user deleted mid-session no longer cuts off the host.
  • ttp stop lost a session whose table was still loaded. The lock was deleted in a finally even when destroy_rules() failed. The lock now stays and stop exits 8 (as close_redirected_or_retain already does).
  • --allow-root exempted root in filter_out only. Root's TCP and DNS still went to Tor while its UDP left in cleartext. Root is now exempt in the NAT chain too, like a --bypass-user; its loopback DNS still goes to Tor. Tor verification already runs as nobody, so it is unaffected.
  • A failed DNS restore reported success. restore_dns now returns whether it succeeded; stop exits 1 and says so.
  • A conntrack -F timeout aborted the teardown before the rules were removed. It is a warning now, like a failed flush.

Tests

  • The VPN guard's JSON exceptions and TTP's nft text are compared (both families). A one-number edit to either now fails.

Removed

  • The pre-0.5 orphan recovery in start (only a 0.4.x lock reached it; every 0.5 lock was already refused). The docs promising auto-recovery after kill -9 were wrong for 0.5 and are corrected.
  • watchdog_active / watchdog_pid in the lock: written, never read.
  • state.py's re-exports of ttp.ux.

Each new test was checked against a mutation of the fix it covers.

🤖 Generated with Claude Code

onyks-os and others added 9 commits November 30, 2026 19:29
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>
@onyks-os
onyks-os merged commit c6897e4 into main Nov 30, 2026
39 checks passed
@onyks-os
onyks-os deleted the fix/audit-findings branch November 30, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant