Repository navigation
Workspaces phase 4a: schema for provider keys, MATE_SECRET_KEY required in production (#277) - #347
Merged
Merged
Conversation
…ed in production (#277) V049 adds workspace_provider_keys (a workspace's key per provider, encrypted with MATE_SECRET_KEY, unique per workspace and provider) and workspace_settings (a workspace's own value for an installation setting). Nothing reads them yet. The provider key column joins the secret columns the auth server encrypts at startup. With MATE_ENV=production the auth server refuses to start without MATE_SECRET_KEY, unless MATE_ALLOW_INSECURE_DEFAULTS is set.
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.
Phase 4a of the 2.0 plan (#277): the schema for provider keys per workspace, and
MATE_SECRET_KEYbecomes required in production.Schema (V049, all three dialects)
workspace_provider_keysholds a workspace's key for one model provider, with an optionalbase_url.workspace_id,provider) is unique, and the row is deleted along with its workspace.api_keyisEncryptedText, so the auth server's startup pass encrypts a value stored in the clear, as it does the other secret columns (_secret_columns).encrypted_value. It isapi_keyhere because the model reads it decrypted, as withagents_config.model_api_key.workspace_settings: a workspace's own value for an installation setting, keyed by (workspace_id,setting_key). It replaces the plan'ssystem_settings.workspace_id, as 2.0 plan: phase 4 split into seven PRs (#277) #346 decided.Nothing reads or writes either table yet. 4b and 4d read them, and 4e adds the routes that write them.
MATE_SECRET_KEYsecret_box.check_key_at_startup(enforce)raises when the key is missing and the auth server enforces secure defaults. That happens withMATE_ENV=production, unlessMATE_ALLOW_INSECURE_DEFAULTSis set. Otherwise it only warns, as before.For the 2.0 release notes: a production installation without
MATE_SECRET_KEYno longer starts.Tests
TestProviderKeySchemachecks one key per provider per workspace, one value per setting, and that acreate_allschema followed by the migrations matches.test_secret_boxcovers the new secret column and the production refusal._secret_columns;test_client_contract.pypasses unchanged.Docs
docs/dev/deployment.md(production checklist, secrets at rest),docs/dev/database-and-migrations.md(V049),.env.example, the README and the regenerated reference are updated.driftlistsdocs/dev/architecture.mdforauth_server.py. It doesn't describe the startup checks, so it still holds.