Repository navigation
fix(install): migrate existing encryption key instead of generating a fresh GROUNDCONTROL_SECRET - #117
Open
teckedd-code2save wants to merge 1 commit into
Open
fix(install): migrate existing encryption key instead of generating a fresh GROUNDCONTROL_SECRET#117teckedd-code2save wants to merge 1 commit into
teckedd-code2save wants to merge 1 commit into
Conversation
… fresh GROUNDCONTROL_SECRET The upgrade path appended a random GROUNDCONTROL_SECRET to .env whenever it was missing, which overrode prisma/.groundcontrol-key — the key that actually encrypted secrets already at rest. This orphaned those secrets (AES-GCM auth tags no longer verified) and broke GitHub App decryption. Now, when GROUNDCONTROL_SECRET is absent, the installer migrates the existing file key into the env var instead of generating a fresh one, so an upgrade can never change the encryption key out from under already-encrypted data.
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.
What
scripts/install(upgrade path) appended a randomGROUNDCONTROL_SECRETto.envwhenever it was missing, which overrodeprisma/.groundcontrol-key— the key that actually encrypted secrets already at rest.Why
GROUNDCONTROL_SECRETtakes precedence over the file key incrypto.getKey(). So a fresh install/upgrade that added the env var changed the effective decryption key out from under already-encrypted secrets, orphaning them: AES-GCM auth tags no longer verified and the GitHub App private key (and any otherenc:v1:secret) failed to decrypt withUnsupported state or unable to authenticate data.Change
When
GROUNDCONTROL_SECRETis absent, the installer now reads the existing/app/prisma/.groundcontrol-key(viadocker exec, when a 64-char key is present) and migrates it intoGROUNDCONTROL_SECRET, rather than generating a fresh random key. It only falls back to generating a new key when there's no existing file key.Validation
bash -n scripts/install— cleanGROUNDCONTROL_SECRETnow equals the file key, and theenc:v1:GitHub App private key decrypts successfully.