Repository navigation
feat: GSM Secrets - Backfill API to move plain-text secrets into the store - #477
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
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.
Stacked on #475; merge after it.
What
An admin route moves existing plain-text secrets into the configured store, a batch at a time:
user_idandsecret_nameare optional filters: one secret, one owner's secrets, or one name across owners. The counts always cover the whole table, sostill_plaintextshows how far the whole move has got.Each call takes up to
limitrows (1–1000, default 50) that have nostorageentry. For each one, under a row lock, it checks the row is still plain, saves the value through the store'ssave, and commits that row before touching the next. Call it again untilstill_plaintextis 0.savereturned, plus itsstorageentryalready_storedsavefails part-wayWhy
#474 saves new and updated values through the store, and #475 reads them back at launch; rows written before a store was configured still hold plain text. This moves them. The value lands in the store outside the database, so each row commits on its own: a failure part-way never rolls back a row whose value is already saved. A crash between
saveand the commit leaves one extra stored value and the row still plain, so the next call moves it again.Verification
tests/test_secret_value_store.py: moves plain rows; a re-run moves nothing new;limitis honoured across calls; a failingsavekeeps the earlier rows moved and the rest plain; rows in another store are left alone; no store is refused; the route answers admins and refuses other users (403);user_id,secret_nameand both together move only the matching rows, through the service and the route.limit, dropping either filter, and the route not passing them each turn tests red.tests/instrumentation/test_execution_tracing.pyfail onmaster.