You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
--encryption-key and --old-encryption-key flags are interpreted as RAW bytes, limiting available entropy #1410
(I apologize ahead if this should be better classified as a feature request, since this would requiring breaking compatibility or adding a new feature)
When parsing --encryption-key and --old-encryption-key, the provided string is just converted to raw bytes, instead of being parsed as base64 or hex as is usually the case with encryption keys. This means that some byte values (e.g. the NUL byte) can't be easily supplied, and other byte values (1-31, 127-255) are hard to supply in a consistent way. With only 95 safe character values per byte, we lose 1.5 bits of entropy on the byte, so a nominally 128-bit key will only have 104 bits of entropy available and a 256-bit key would have 208 bits of entropy.
Parsing keys as hex-encoded or base64-encoded values will easily solve the issue, but is going to break down backward compatibility quite spectacularly, so Concourse will need to support a new set of arguments, e.g. --encryption-key-hex and --old-encryption-key-hex or --encryption-key-base64 and --old-encryption-key-base64.
Sometimes people like to use a file to store secrets in (e.g. docker secrets) and have an environment variable contain the path to the file instead of the secret itself, because environment variable values can end up being displayed in several places.
Maybe an easy-ish solution here is to provide a --encryption-key-file arg and CONCOURSE_ENCRYPTION_KEY_FILE variable, which if set, reads raw bytes from the file and uses that for the key? Then we don't have to worry about encodings, and we also keep the key value out of env vars/cmdline.
I don't know enough about encryption to comment on this, but it sounds like a reasonable thing that should be done at some point. Anyone is free to make a PR addressing this.
Hi! I'd like to work on this issue. My plan is to add CipherHex and CipherBase64 types to the concourse/flag package, and then add --encryption-key-hex, --encryption-key-base64 (and their --old- variants) flags to the CLI. The existing --encryption-key flag would remain unchanged for backward compatibility. Does this approach sound good?
I've already validated locally that the new flags compile and appear in concourse web --help using docker-compose with a replace directive pointing to my fork.
Thanks Samuel! I'll check out the PR this week hopefully. Quickly skimmed your comments and I think your plan sounds good, leaving existing flags as-is and adding new ones for hex or base64 encodings. TY for picking this up!
I've merged the PR in concourse/flag. I'm going to merge that repo into the main repo here. We don't get any benefit from having flag as a separate repo and it'll be easier to manage directly in the main repo instead.
Activity
waweber commentedon Jul 14, 2021
Hello from 2021!
Sometimes people like to use a file to store secrets in (e.g. docker secrets) and have an environment variable contain the path to the file instead of the secret itself, because environment variable values can end up being displayed in several places.
Maybe an easy-ish solution here is to provide a
--encryption-key-filearg and CONCOURSE_ENCRYPTION_KEY_FILE variable, which if set, reads raw bytes from the file and uses that for the key? Then we don't have to worry about encodings, and we also keep the key value out of env vars/cmdline.taylorsilva commentedon Jan 6, 2025
I don't know enough about encryption to comment on this, but it sounds like a reasonable thing that should be done at some point. Anyone is free to make a PR addressing this.
samuelBarreto commentedon Apr 19, 2026
Hi! I'd like to work on this issue. My plan is to add CipherHex and CipherBase64 types to the concourse/flag package, and then add --encryption-key-hex, --encryption-key-base64 (and their --old- variants) flags to the CLI. The existing --encryption-key flag would remain unchanged for backward compatibility. Does this approach sound good?
cipher: add CipherBase64 and CipherHex types
cipher: add CipherBase64 and CipherHex types
samuelBarreto commentedon Apr 20, 2026
Step 1 (done): I opened a PR in the
concourse/flagpackage addingCipherBase64andCipherHextypes:Changes in
concourse/flag:CipherBase64type — decodes base64 before creating the AES-GCM cipherCipherHextype — decodes hex before creating the AES-GCM cipherunmarshalCipherhelper to avoid duplicationCiphertype remains unchanged (fully backward compatible)Step 2 (waiting for flag PR merge): I'll open a follow-up PR in
concourse/concourseto add the new CLI flags:--encryption-key-base64/--old-encryption-key-base64--encryption-key-hex/--old-encryption-key-hexI've already validated locally that the new flags compile and appear in
concourse web --helpusing docker-compose with areplacedirective pointing to my fork.taylorsilva commentedon Apr 20, 2026
Thanks Samuel! I'll check out the PR this week hopefully. Quickly skimmed your comments and I think your plan sounds good, leaving existing flags as-is and adding new ones for hex or base64 encodings. TY for picking this up!
taylorsilva commentedon Apr 20, 2026
I've merged the PR in concourse/flag. I'm going to merge that repo into the main repo here. We don't get any benefit from having
flagas a separate repo and it'll be easier to manage directly in the main repo instead.taylorsilva commentedon Apr 20, 2026
@samuelBarreto Once #9541 is merged, you can continue implementing your changes.
atc: add base64 and hex encryption key flags
samuelBarreto commentedon Apr 21, 2026
Hi! I've opened a PR to resolve this issue: #9542
Changes:
--encryption-key-base64,--encryption-key-hexand their--old-variants to the CLIatc/atccmd/command.go(RunCommand + Migration structs and key resolution logic)atc/scripts/db_decrypt.goto support the new key formats--encryption-keyflag remains unchanged for backward compatibility@taylorsilva