fix(live): harden hostname helpers (-I isolated python, transactional rollback, multiline guard, disjoint USB/disk pairs) #96
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/harden-hostname-helpers"
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?
Addresses all four post-merge Codex findings on
67c9bd8before PR B:/usr/bin/python3 (never trusts caller PATH) and runs with -I so caller
CWD modules (e.g. poison secrets.py/pathlib.py) can never be imported.
in full before writing anything, preserves existing file modes and uid/gid,
stages both temp files atomically, and rolls back both files (content +
mode + ownership) if replace or live hostname(1) fails.
LC_ALL=C grep -Eq so multiline TARGET_HOSTNAME cannot pass via one valid line.
derive_pair() (plus new 'pair' subcommand), guaranteeing usb != disk for
every input including Helix-USB, Helix-USB-USB, USB, localhost-usb, and
truncated 63+ char names.
Verified on Debian 13 (debby) and FreeBSD 15.1-RELEASE-p7 (valhala):
clawdie-hostname-helper-test 59/59, retarget-be-test 103/103,
clawdie-live-selfcheck-test 25/25, doas-policy-test 83/83 (FreeBSD live doas -C).