Repository navigation
feat: GSM Secrets - Keep new secrets in an optional store - #474
Merged
Merged
Conversation
This was referenced Nov 18, 2026
Contributor
|
@yuechao-qin How about replacing the whole |
…s on first use SecretStore is an abstract base class whose subclass methods are wrapped to move the caller's rows out of the secret table first. Replaces the storage-type hook: no storage flag, no 503 handler.
Launches read the table first, then the store, without writing; get no longer takes a session.
…o the store SecretStore is a Protocol again; no move on use. PUT/DELETE lock the row only with a store; DELETE also removes a store copy; list reads the store.
Ark-kun
reviewed
Nov 19, 2026
Ark-kun
reviewed
Nov 19, 2026
Ark-kun
approved these changes
Nov 19, 2026
…t_secrets to list, store parameters to _secret_store The module name clashed with the parameter (secret_store: secret_store.SecretStore). The store's list returns builtins.list, because a plain list there means the method itself on Python 3.14. The Protocol methods drop their redundant ellipses; a docstring is a full body.
Collaborator
Author
The table path is what serves the secrets saved before the store existed, so it stays until the backfill has moved them; once every environment's backfill reports |
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.
What
Secrets can now live outside the database: give
setup_routesa_secret_store, and new secrets go to it. A secret already in thesecrettable stays there and works as today until it is moved. Without a store, nothing changes.POST /api/secrets/create(409 if the store has it)PUT /api/secrets/{name}update(404 if missing); an empty description keeps the stored one, as todayDELETE /api/secrets/{name}delete(404 if missing)GET /api/secrets/listSecretStore, insecret_interfaces.py, is aProtocolwithcreate,update,get,listanddelete; a store never sees the session or the table.StoredSecretcarries the table's columns; itsvalueis left out of repr, so a logged secret never shows it.With a store, PUT and DELETE read the row with
FOR UPDATE. The lock is on that one row (the lookup is by primary key), so a bulk move of the same row either finishes first or waits. DELETE also deletes the store's copy, in case a bulk move stopped after copying the row but before deleting it; otherwise a deleted secret could come back.Why
Secret values sit in the database as plain text, so anyone who can read the table or a backup can read every secret. This lets a deployment keep them in a store of its choice, and the backend stays free of any provider.
The routes never move anything, so a request does only what it says. The next two PRs read from the store at launch and add an admin route that moves the remaining rows in bulk; until that runs, secrets still in the table are missing from the list but keep working everywhere else.
Verification
tests/test_secret_store.py(15 tests, fake in-memory store): no store keeps the table behaviour; create writes no row; create of a name still in the table is 409 and changes nothing; update of a row updates it in place; update of a stored secret keeps itscreated_atand description; an empty description keeps the stored one; update of a missing secret is 404; delete of a row, of a row with a leftover store copy, and of a stored secret, then 404; list reads only the store; the row is locked with a store and not without; the value never shows in repr;setup_routespasses the store through (200, 409, list).tests/instrumentation/test_execution_tracing.pyfail onmaster. Also passes on Python 3.14.