Repository navigation
fix(dns): make save.sh encrypt tfstate atomically (#6536) - #8021
Merged
Merged
Conversation
5 tasks
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Fixes #6536. save.sh now encrypts to a temp file in the same directory, verifies it is non-empty and decrypts back to exactly the plaintext state (which also proves lineage, mirroring plan.sh), preserves the existing .enc mode, and atomically renames it over terraform.tfstate.enc. A failed or interrupted sops run leaves the previous .enc byte-identical; the EXIT trap removes the temp file and the .lock exactly as before. Adds infra/dns/test_save_atomic.sh (stub identity-cipher sops; oracle: the previous .enc is the record): failing -e leaves .enc unchanged with non-zero exit and no temp/lock residue, succeeding -e installs the new ciphertext, already-current fast path still skips re-encryption - 9/9 checks pass on the laptop. load.sh assessment (recorded on #6536): its in-place decrypt write is safe-by-reconstruction - the plaintext target is fully re-derivable from the intact .enc, so a truncated plaintext is recovered by re-running load; it is documented rather than changed. Shellcheck reports only pre-existing style findings for save.sh. Queue task 14343, lane code-h.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.