test(enterprise/dbcrypt): add Rotate/Decrypt/Delete regression tests#26979
Open
BobbyHo wants to merge 2 commits into
Open
test(enterprise/dbcrypt): add Rotate/Decrypt/Delete regression tests#26979BobbyHo wants to merge 2 commits into
BobbyHo wants to merge 2 commits into
Conversation
cliutil.go's Rotate, Decrypt, and Delete are the only interface for migrating database encryption keys, but had zero test coverage (#25389). Adds per-table tests for the 7 currently covered tables (user_links, external_auth_links, user_secrets, gitsshkeys, ai_providers, ai_provider_keys, user_ai_provider_keys), covering the happy path for all three functions plus, for Rotate/Decrypt, the failure mode where an active dbcrypt_keys entry is omitted from the operation.
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.
Related to #25389.
enterprise/dbcrypt/cliutil.go'sRotate,Decrypt, andDeleteare the only interface for migrating database encryption keys, but had zero test coverage. Addsenterprise/dbcrypt/cliutil_test.gowith per-table regression tests for all three functions.Covered
The 7 tables currently handled by
Rotate/Decrypt/Delete:user_links,external_auth_linksuser_secretsgitsshkeysai_providers,ai_provider_keys,user_ai_provider_keysEach table has a happy-path test verifying live rows (and, where the schema allows it, soft-deleted rows) round-trip correctly.
RotateandDecryptadditionally have a failure-path test per table confirming the operation aborts cleanly with aDecryptFailedError, leaving data untouched, when an activedbcrypt_keysentry isn't included in the operation.Deletetakes no cipher argument, so instead each test confirms an encrypted row is wiped while a never-encrypted row is left untouched by theWHERE ... IS NOT NULLclauses in its SQL.Gaps (follow-up)
crypto_keys,mcp_server_configs, andmcp_server_user_tokensare encrypted at rest but are not yet handled byRotate/Decrypt/Deleteat all. This is the bug reported in #25381: an incomplete--old-keys/--keyslist against these tables fails with a foreign key violation on revoke. A follow-up PR will add both thecliutil.gofix and matching regression tests for these three tables.