Skip to content

bug(enterprise/dbcrypt): key rotate, decrypt and delete skip plugin configs #122

Closed

Description

@ibetitsmike

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

  1. added
    bug
    on Nov 10, 2026
  2. added a commit that references this issue on Nov 10, 2026
    69f04bd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions