Repository navigation
fix(enterprise/dbcrypt): handle plugin configs in key rotate, decrypt and delete - #142
Conversation
… and delete Fixes #122
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review
|
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Closing and reopening only to make GitHub recompute the merge ref against current main ( |
The merge ref now points at current main ( |
Merge evidence for head
|
Fixes #122
coder server dbcrypt rotate,decryptanddeleteskippedplugins.config, which the fork encrypts with dbcrypt and whoseconfig_key_idreferencesdbcrypt_keys. Rotate and decrypt left configs on the old key, so revoking it failed onplugins_config_key_id_fkey; delete left ciphertext, so the same foreign key blocked revoking the keys.This adds a plugins step behind the hooks that #119 added for
chat_secret_answersinenterprise/dbcrypt/fork_cliutil.go:cliutil.gohook lines now callforkRecryptSecrets, which runs the existing chat secret answer step and then the new plugin step. The plugin step pages through plugins whose key is not the target by ID, decrypts each config and encrypts it again with the primary cipher, or writes it back as plaintext when there is none. The update only applies when the row still holds the config that was read, so a config changed meanwhile is never overwritten. It leavesupdated_atalone, because the plugin manager restarts a plugin wheneverupdated_atchanges. Blank configs stay plaintext with no key, as on insert; the blank check moved fromforkCrypttodbCryptso both paths share it.gitsshkeys.private_key,ai_providers.settings,workspace_secrets.value). A plugin row carries the installed module, its grants and its user links, so deleting it would uninstall the plugin. Delete therefore clears it likeai_providers.settings:config = ''(the column default),config_key_id = NULL. It bumpsupdated_at, so running plugins restart with the cleared config, and an admin sets the config again.cliutil.gochanges by two lines (the hook name);Deletealready callsforkDeleteEncryptedSecrets.Validation
TestPluginConfigsKeyCommands(fork_cliutil_test.go) runs each command on plugins with a config, with each command's own check that key revocation succeeds:updated_at, and a blank-config plugin stays plaintext.config_key_idis NULL.updated_at, and a plaintext plugin keeps its config.forkRecryptSecrets, Rotate and Decrypt fail withviolates foreign key constraint "plugins_config_key_id_fkey".UPDATEin delete disabled, Delete fails the same way.gofmt,go vet ./enterprise/dbcrypt/andgo test ./enterprise/dbcrypt/...on Postgres 17 pass../enterprise/dbcrypt/...reports 0 issues, both with--new-from-merge-base=origin/mainand without it.