Repository navigation
atc: add base64 and hex encryption key flags - #9542
Merged
taylorsilva merged 2 commits intoApr 21, 2026
Merged
taylorsilva merged 2 commits into
taylorsilva merged 2 commits into
Conversation
Add --encryption-key-base64, --encryption-key-hex and their --old- variants to the CLI, allowing users to supply encryption keys with full byte range (0x00-0xFF) instead of being limited to printable ASCII characters. Closes concourse#1410 Signed-off-by: samuel.andrade <[email protected]>
consolidated duplicate logic into one function in the db/encryption package. Also made sure we error if multiple keys are passed in. Signed-off-by: Taylor Silva <[email protected]>
taylorsilva
approved these changes
Apr 21, 2026
Member
There was a problem hiding this comment.
LGTM - I pushed a commit that refactors some of the code from command.go into encryption_key.go. I also made one behavioural change: if multiple key formats are provided an error is returned instead of just picking the first one. We don't want to assume things and potentially confuse operators about which key the db was encrypted with.
Thanks for working on this! Once the PR checks pass again I'll merge it.
Member
|
TODO: will need to add these env vars to the helm chart and bosh packaging |
This was referenced Apr 21, 2026
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.
Changes proposed by this PR
closes #1410
--encryption-key-base64and--encryption-key-hexflags toRunCommandstruct--old-encryption-key-base64and--old-encryption-key-hexflags toRunCommandstructMigrationstructRunCommand.newKey()andRunCommand.oldKey()to resolve keys from all three formats (raw → base64 → hex)Migration.resolveNewKey()andMigration.resolveOldKey()helper functionsatc/scripts/db_decrypt.goto support the new key formatsReasoning: The existing
--encryption-keyflag interprets the key as raw bytes ([]byte(val)), limiting entropy to ~95 printable ASCII characters per byte. A nominally 256-bit key only provides ~208 bits of entropy. The new flags allow users to supply keys encoded in base64 or hex, enabling the full byte range (0x00-0xFF) and full 256-bit entropy.The
CipherBase64andCipherHextypes used by these flags were already merged intoflag/cipher.govia #9541.Notes to reviewer
--encryption-keyand--old-encryption-keyflags are unchangedthe priority order above appliesan error is returneddocker compose up --build— new flags appear inconcourse web --helpRelease Note
Added
--encryption-key-base64,--encryption-key-hex,--old-encryption-key-base64, and--old-encryption-key-hexflags, allowing encryption keys to be provided in base64 or hex encoding for full 256-bit entropy support.