-
Notifications
You must be signed in to change notification settings - Fork 4k
storage: fix algorithm label for 256-bit V2 encryption keys #160005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
storage: fix algorithm label for 256-bit V2 encryption keys #160005
Conversation
When generating 256-bit encryption keys in the version 2 (JWK) format, the algorithm was incorrectly labeled as 192-bit in the output JSON. This change ensures the label correctly reflects the 256-bit size. Resolves: cockroachdb#160004 Release note (bug fix): Fixed a bug where 256-bit encryption keys generated in the V2 (JWK) format were incorrectly labeled as 192-bit. Epic: None
|
It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR? Thank you for contributing to CockroachDB. Please ensure you have followed the guidelines for creating a PR. My owl senses detect your PR is good for review. Please keep an eye out for any test failures in CI. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
There was a problem hiding this 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 fixes a copy-paste bug where 256-bit encryption keys in the V2 (JWK) format were being incorrectly labeled as 192-bit. The fix ensures proper consistency between encryption type and its JWK algorithm string representation.
Key Changes:
- Corrected the return value for
EncryptionType_AES_256_CTR_V2to return the correct algorithm string "cockroach-aes-256-ctr-v2" instead of "cockroach-aes-192-ctr-v2"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| case EncryptionType_AES_256_CTR_V2: | ||
| return "cockroach-aes-192-ctr-v2", nil | ||
| return "cockroach-aes-256-ctr-v2", nil |
Copilot
AI
Dec 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JWKAlgorithm function lacks test coverage. Consider adding tests that verify all encryption types return the correct algorithm strings, especially to prevent similar copy-paste errors in the future. A simple table-driven test that checks both JWKAlgorithm and EncryptionTypeFromJWKAlgorithm for all encryption types would help catch issues like this bug.
When generating 256-bit encryption keys in the version 2 (JWK) format,
the algorithm was incorrectly labeled as 192-bit in the output JSON.
This change ensures the label correctly reflects the 256-bit size.
Resolves: #160004
Release note (bug fix): Fixed a bug where 256-bit encryption keys
generated in the V2 (JWK) format were incorrectly labeled as 192-bit.
Epic: None