feat(deploy): safely initialize the production environment - #4760
Open
SmithLabsLLC wants to merge 1 commit into
Open
feat(deploy): safely initialize the production environment#4760SmithLabsLLC wants to merge 1 commit into
SmithLabsLLC wants to merge 1 commit into
Conversation
Signed-off-by: Smith Labs LLC <232409717+SmithLabsLLC@users.noreply.github.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.
Summary
./run.sh init <domain> <owner-pubkey-hex>.envwith mode 600 and atomic no-overwrite behaviorWhy
The production quick start currently asks operators to copy
.env.exampleandreplace every placeholder manually. Missing a placeholder, using
URL-unsafe database credentials, leaving broad file permissions, or
accidentally overwriting stable secrets can break or weaken a deployment.
Safety
The initializer uses
.env.exampleas the non-secret source template, runsunder
umask 077, generates secrets with OpenSSL, and atomically links acompleted owner-only temporary file into place. It refuses an existing file,
symlink, or creation race and never generates or rotates the owner's identity.
Testing
shellcheck deploy/compose/run.sh deploy/compose/test-init.shbash -n deploy/compose/run.sh deploy/compose/test-init.shdeploy/compose/test-init.sh.env.init.*is ignoredgit diff --checkThe contract covers successful generation, normalized inputs, every generated
field shape, removal of assignment placeholders, mode 600, content-preserving
overwrite refusal, invalid domain and public-key rejection, and symlink
refusal. It also keeps the missing-
.envinstructions tied to the initializerand verifies that successful initialization prints only the fixed completion
message.
Review
One Fable 5 xhigh review initially returned
NEEDS CHANGES. All accepted andapproved findings were incorporated: the missing-
.enverror and validationwalkthrough use the new command, the manual fallback creates mode-600 output
before editing, and orphaned
.env.init.*files are ignored. No secondindependent review was run.
Scope
This creates a local configuration file only. It does not start Docker,
deploy Buzz, read a real secret file, generate an owner private key, or rotate
existing credentials.