Repository navigation
feat: GSM Secrets - Save secret values through an optional store hook - #474
Open
yuechao-qin wants to merge 1 commit into
Open
yuechao-qin wants to merge 1 commit into
yuechao-qin wants to merge 1 commit into
Conversation
| value="hf_FAKE123")` returns `("", {"version": "4"})` — the row keeps `""`, and `{"version": "4"}` | ||
| is what `get` and `delete` are later given as `storage_details`. | ||
| """ | ||
| ... |
| self, *, storage_details: dict[str, Any], user_id: str, secret_name: str | ||
| ) -> str: | ||
| """Returns the value that `save` saved with these storage details.""" | ||
| ... |
| self, *, storage_details: dict[str, Any], user_id: str, secret_name: str | ||
| ) -> None: | ||
| """Retires the value that `save` saved with these storage details.""" | ||
| ... |
This was referenced Nov 18, 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 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
Secret values can now be kept outside the database: give
setup_routesasecret_value_store, and creating or updating a secret saves the value through the store, keeping in the row only what the store returns and a note inextra_datasaying where. Without a store, nothing changes.Saving a secret,
POST /api/secrets/?secret_name=TOKENwith{"secret_value": "s3cret"}, stores:secret_value"s3cret"savereturned, e.g.""extra_datanull{"storage": {"type": "<store type>", "details": {"version": "4"}}}saveputs the value in the store, then the row commitssaveputs the new value in the store, the row commits, thendeleteretires the value it replaceddeleteretires its valueA row whose
storagenames a store this server is not configured with is never changed: update and delete return 503, naming both stores, and leave the row as it was. Writing plain text over it, or deleting the row, would leave the stored value behind, still readable.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 adds the write half as a hook, so a deployment chooses the store (e.g. a cloud secret manager) and the backend stays free of any provider. Reading through the store at launch and moving existing rows follow in the next two PRs; until a deployment passes a store, behaviour is unchanged.
The value is saved before the row commits and the one it replaces is retired after, so no crash leaves a row naming a value that is gone. A crash between the two leaves an extra stored value, never a missing one.
Verification
tests/test_secret_value_store.py, using a fake in-memory store: no store keeps plain text through create, update and delete; a store leaves only whatsavereturned; update retires the previous value only once the committed row names the new one; delete retires after the row is gone; a plain row moves into the store on update; otherextra_datakeys survive; save and delete are refused, row unchanged, when the row is in another store or there is none; creating an existing name saves nothing; a failed retire is logged without the value;setup_routespasses the store through; a refusal is a 503.tests/instrumentation/test_execution_tracing.pyfail onmaster.