You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(enterprise/dbcrypt): key rotate, decrypt and delete skip plugin configs #122
Xum (AI agent) opened this on behalf of @ibetitsmike.
Problem
The coder server dbcrypt rotate, decrypt and delete commands do not handle the fork's plugins.config column, although the fork encrypts it with dbcrypt.
plugins.config_key_id references dbcrypt_keys(active_key_digest) (chatd node 01a1bc7b, coderd/database/migrations/chatdmig/nodes/01a1bc7b-6e0c-783d-8945-1c634ab35eea_plugins.up.sql:23, from feat: add chat plugins backed by a chatd fork node #2).
enterprise/dbcrypt/fork_forkdb.go:28-60 encrypts plugins.config on insert and decrypts it on read.
enterprise/dbcrypt/cliutil.go re-encrypts, decrypts and clears the upstream encrypted columns, but has no plugin step.
Effect when dbcrypt is enabled and a plugin has a config:
rotate leaves plugin configs on the old key, and revoking that key fails on the foreign key.
decrypt leaves plugin configs encrypted, so they are unreadable once dbcrypt is turned off.
delete leaves encrypted plugin configs, and the foreign key blocks deleting the keys.
Fix
Add a plugins step to rotate, decrypt and delete. #119 adds enterprise/dbcrypt/fork_cliutil.go with one hook line in each command for chat_secret_answers; the plugins step fits the same hooks. Test it the same way as TestChatSecretAnswersKeyCommands, with a negative control.
Found by W8 while it fixed the same gap for chat_secret_answers in #119.
Activity
fix(enterprise/dbcrypt): handle plugin configs in key rotate, decrypt…