fix(config): validate access_key_encryption at startup#3710
Merged
fiftin merged 1 commit intosemaphoreui:developfrom Mar 23, 2026
Merged
fix(config): validate access_key_encryption at startup#3710fiftin merged 1 commit intosemaphoreui:developfrom
fiftin merged 1 commit intosemaphoreui:developfrom
Conversation
Refuse to start if access_key_encryption is not valid base64 or decodes to an invalid AES key size (must be 16, 24, or 32 bytes). Previously a misconfigured key (e.g. 48 bytes) would only surface as a cryptic "crypto/aes: invalid key size" error when trying to store a secret.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds startup-time validation for access_key_encryption so Semaphore fails fast on misconfiguration, instead of surfacing a late runtime error when encrypting/decrypting stored secrets.
Changes:
- Add
access_key_encryptionvalidation to ensure it is valid base64 and decodes to an AES key length of 16/24/32 bytes. - Invoke this validation during
validateConfig()so invalid configuration prevents startup. - Extend config validation tests to cover valid/empty/invalid
access_key_encryptionscenarios.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
util/config.go |
Adds validateAccessKeyEncryption and calls it from validateConfig() to enforce valid base64 + AES key sizes at startup. |
util/config_test.go |
Adds test cases verifying AccessKeyEncryption accepts empty/valid keys and rejects invalid base64 and invalid decoded sizes. |
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.
Refuse to start if access_key_encryption is not valid base64 or decodes to an invalid AES key size (must be 16, 24, or 32 bytes). Previously a misconfigured key (e.g. 48 bytes) would only surface as a cryptic "crypto/aes: invalid key size" error when trying to store a secret.