feat(enterprise/dbcrypt): encrypt ai_providers and ai_provider_keys at rest - #25326
Merged
Conversation
This was referenced May 14, 2026
Contributor
Author
dannykopping
force-pushed
the
dk/aibridge-providers-dbcrypt
branch
from
May 14, 2026 10:57
df25e7f to
2573348
Compare
dannykopping
force-pushed
the
dk/aibridge-providers-db
branch
from
May 14, 2026 10:57
1a61871 to
692e9c3
Compare
dannykopping
force-pushed
the
dk/aibridge-providers-dbcrypt
branch
3 times, most recently
from
May 14, 2026 13:20
fffa3e9 to
1d16ab9
Compare
dannykopping
force-pushed
the
dk/aibridge-providers-db
branch
from
May 14, 2026 13:20
22dabfa to
62b664c
Compare
dannykopping
force-pushed
the
dk/aibridge-providers-dbcrypt
branch
from
May 14, 2026 13:38
1d16ab9 to
da18210
Compare
dannykopping
changed the base branch from
dk/aibridge-providers-db
to
graphite-base/25326
May 14, 2026 14:10
dannykopping
force-pushed
the
dk/aibridge-providers-dbcrypt
branch
from
May 14, 2026 14:11
da18210 to
86dbfac
Compare
dannykopping
force-pushed
the
graphite-base/25326
branch
from
May 14, 2026 14:11
17d922e to
841b777
Compare
dannykopping
force-pushed
the
dk/aibridge-providers-dbcrypt
branch
from
May 14, 2026 14:11
86dbfac to
f78b55a
Compare
…t rest Adds dbcrypt overrides for the ai_providers.settings and ai_provider_keys.api_key columns so secrets are encrypted at rest on deployments configured with CODER_EXTERNAL_TOKEN_ENCRYPTION_KEYS. Includes key-rotation support in cliutil.Rotate so existing rows are re-encrypted with the new primary cipher, and a DeleteAIProviderByID override so soft-deleted rows return decrypted fields like every other read path. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Catches dbcrypt up with the upstream ai_providers query simplification and rename: DeleteAIProviderByID/DeleteAIProviderKey are now :exec so their wrappers are no longer needed, GetAIProviders takes a plain sql.NullBool, and UpdateAIProviderSettings was renamed to UpdateEncryptedAIProviderSettings. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
dannykopping
force-pushed
the
dk/aibridge-providers-dbcrypt
branch
from
May 15, 2026 11:39
f78b55a to
f16f248
Compare
…oader coverage The cliutil tests added in dcdf9cf covered ai_providers only, while none of the other dbcrypt-managed tables (user_links, external_auth_links, chat_providers, user_secrets, etc.) have any cliutil coverage. Drop them so the gap can be closed comprehensively rather than per-table. Tracked in #25389; the original test bodies remain recoverable from dcdf9cf. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Contributor
Author
|
/coder-agents-review |
…tate The previous skip condition (!Valid || matches) silently dropped rows with NULL settings_key_id / api_key_key_id from the rotation loop. That made the "enable encryption for the first time" path a no-op for any existing plaintext data, diverging from how user_links, user_secrets, and chat_providers all handle the same case. Mirror the chat_providers shape: skip empty/blank values, skip rows already on the new primary digest, fall through to UpdateEncryptedX otherwise and let the dbcrypt wrapper encrypt. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ropic
ai_providers.settings is stored as the discriminated
{"_type":"bedrock","_version":1,...} JSON shape (5bfb65f). The
TestAIProviders fixture was using the old flat bedrock_* keys on an
OpenAI-typed provider. Switch the seed to AnthropicProviderType with
the Bedrock base URL so Bedrock-shaped settings only appear where
they're actually meaningful, and update the settings blob (both the
initial value and the UpdateAIProvider sub-test) to the current
discriminated shape.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
dannykopping
marked this pull request as ready for review
May 15, 2026 13:26
johnstcn
approved these changes
May 15, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.

No description provided.