fix(#549,#551): verify plaintext archives before restore; clean up + restart on backup failure#571
Merged
Conversation
…restart on backup failure restore (#549): the plaintext branch extracted with no integrity check — mirror the encrypted branch's full-stream 'tar -tzf' verify so a truncated/corrupt archive is refused before anything is written. backup (#551): guard the plaintext 'sudo tar' (errexit fired straight through before), remove the partial root-owned archive on failure, and restart the stack when it was running — both branches — before erroring with the cause. Tier-1 tests: truncated plaintext restore is rejected with config.json/.env byte-identical; a shadowed-tar backup failure removes the partial archive, restarts the running stack (compose up in the docker log), and exits non-zero. Closes #549 Closes #551 Co-Authored-By: Claude Fable 5 <noreply@anthropic.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.
Closes #549
Closes #551
Summary
Two companion backup/restore failure-path fixes in the
pitheadCLI:stack_restoreextracted withsudo tar -xzfand no integrity check, so a truncated pre-Encryptpithead backuparchives with a passphrase (openssl enc), decrypt on restore #374 archive aborted mid-extraction with config/keys half-overwritten. The fix mirrors the encrypted branch's full-stream verify:tar -tzf "$archive"over the whole archive before extraction, refusing with the same integrity-error message and nothing written.sudo tarinstack_backupwas unguarded — a failure tripped errexit, stranding a stopped stack and leaving a partial root-owned archive that looks valid. Both branches' failure paths now remove the partial archive, restart the stack when it was running (was_running=1), thenerrorout with the cause. The explicitif !style already used by the encrypted branch — no ERR traps. Success path unchanged.Docs:
docs/operations.mdbackup/restore section updated to state both behaviours.Test evidence
Tier-1 (
tests/stack/run.sh), full suite green with the fixes (run twice pre-rebase, backup/restore blocks re-verified post-rebase): 1273 passed, 0 failed.New assertions, all passing with the fixes:
Revert-proof (fixes reverted to develop's
pithead, tests kept):make lintpasses on every surface exceptlint-proto, which needs the Docker daemon (not running on this dev box) — unrelated to this change.make lint-sh,lint-md,lint-docs-voiceall clean.🤖 Generated with Claude Code