Fix data-loss, security, hang and UI bugs found in a codebase audit (GitHub #1) #1
Loading…
Reference in a new issue
No description provided.
Delete branch "github/pr-1"
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?
Copied from https://github.com/charl1xcx/interzone/pull/1, by @TheNarratorsFrevor on GitHub. Discuss it there; this copy follows its commits.
An audit of the whole codebase turned up these bugs; each fix is its own commit with the details. Where a bug could be reproduced, a test reproduces it, and it fails before the fix and passes after.
Data loss and safety
interzone servers rmwith no name deletedconfig.json(andservers rm ../configtoo), printing "✓ Forgot". Profile names are now validated inRemoveProfile/SetActiveand the CLI.l1 -> .,l1/l2 -> ..,l2/evil). Extraction now goes throughos.Root. Bundles also no longer pick up.interzone-vars-*.jsonfiles (admin password) left behind by a killed action.config.jsonwas treated as a first run, and the next save replaced every secret. It's now moved aside toconfig.json.broken-<time>.config.WriteSecretwrites atomically (temp, fsync, rename) and always 0600, following symlinks. It's used for config.json, presets, imports, and the inventory'svars.yml/hosts.https://example.orgmade nested inventory directories, and an importedmatrix_domain: ../../tmp/xwrote outside the playbook.ANSIBLE_HOST_KEY_CHECKING=False. It now usesStrictHostKeyChecking=accept-new, like interzone's own ssh.ps). It now goes through a 0600 vars file.config.before-rollback.jsonfor all servers, and the wizard overwrote the answers even when that backup failed to save. It's now per server and stops on errors.Hangs and crashes
exechung forever on an output line over 1 MB, and ctrl+c couldn't stop it. Long lines now come in pieces, the pipe is drained, andWaitDelayis set./matrix:send.Wait()closed the pipe the receiver was still reading, and a dead receiver hung the sender. Fixed by reordering the waits./etc/os-releasecrashed the app (ids[0]on an empty slice).Config.Clone(), a deep copy, used by every background command.UI
CLI
restore dump.sql --yesstill asked (and failed under cron), andimport PATH --dry-runprinted the usage. A smallparsehelper now accepts both orders, and--still ends the flags.rollbackexits 1 when the self-check finds problems, likeapply.restoreandrollbackreject extra args.-reset -layout bogusmoved the folders aside before complaining about the layout. Options are now validated first.interzone -plain checkexplains that the command goes first, andinterzone helpshows the options.vars.yml
- a,a: b) produced invalid YAML.|block in a YAML field wasn't indented.vars.ymllost their reference copy.{{,{%or{#(which Jinja breaks or silently alters) are flagged in Missing(). mas-cli gets--password=…and--so a leading-isn't read as an option.Build, CI and docs
makestamped the date as the version (2026.10.29), which outranks every release, so self-update never fired. It now usesgit describe. Addedmake test.go test -race. Fixed the CI comment that contradicted.forgejo/workflows/README.md.shots.shno longer usesgrep -qunder pipefail.gradientLinesandcPanel.Not changed (worth a look)
matrix_authentication_service_enabled: falseisn't reflected inUsesMAS()/Breaks().ParseDefaultscuts a multi-line default at a column-0 comment.ShowIfis still written.!unsafe; only the passwords above are checked.gofmt,go vetandgo test -race ./...pass, and staticcheck only reports two style notes.🤖 Generated with Claude Code
exec scanned the command's output with a 1 MB line limit. Ansible's "fatal: ... => {json}" dumps can be longer; the scanner then stopped, nothing read the pipe again, the command blocked writing to it, and even ctrl+c only got as far as "aborting…". Long lines now come in pieces, whatever is left is drained, and Wait gives up on leftover children after 10 seconds. serverNeeds indexed the first word of the os-release ID, so a server (or local machine) without /etc/os-release crashed the whole app when its mirrors were checked. It now says it doesn't know the OS, as for any other unknown one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>- Ansible runs every value through Jinja, so an admin or sudo password with "{{" or "{%" failed the deploy, and one with "{#…#}" was quietly shortened, creating the admin with a password other than the one saved. Missing() now names them before the deploy starts. - mas-cli read a new password starting with "-" as an option. The password goes as --password=… and the user name after "--". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>