Skip to content

fix(config): validate access_key_encryption at startup#3710

Merged
fiftin merged 1 commit intosemaphoreui:developfrom
abh:validate-key
Mar 23, 2026
Merged

fix(config): validate access_key_encryption at startup#3710
fiftin merged 1 commit intosemaphoreui:developfrom
abh:validate-key

Conversation

@abh
Copy link
Copy Markdown
Contributor

@abh abh commented Mar 22, 2026

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.

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.
Copilot AI review requested due to automatic review settings March 22, 2026 05:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_encryption validation 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_encryption scenarios.

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.

@fiftin fiftin merged commit 6b2f3b8 into semaphoreui:develop Mar 23, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants