Repository navigation
F5 masking, Gate 1 step 2: key domains and rotation - #215
Merged
Merged
Conversation
fox mask key [status|create|rotate|drop|use]: domains whose masks hash apart, a table's masks put under one, and a key rotated on every running branch while masked readers read the old masks until each table is done, then the old key deleted. A Keys panel on the Masking page, /api/masking/keys and /api/masking/key, every change in the security log.
…main asks only branches that may use it A write already running when a rotation swapped a table's masks finished with triggers naming a shadow just renamed away. The start, swap and repoint now hold the table's writes for a moment (reads go on), bounded and retried. A stopped branch blocks deleting a domain only if a table was put under it there or it was made since the domain was. The default key's making time is its file's.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Masking (F5), Gate 1 step 2: key domains and rotation (design, section 8). Builds on step 1 (#214).
What it does
fox mask key [status] [--json]lists each key domain, its key number, when it was made and rotated and by whom, the tables under it on running branches, and any made under an older key. It never shows a key.fox mask key create <domain> [--yes]makes a domain with its own key. Tables in different domains hash apart, so they can't be joined on masks; joins work within one domain.fox mask key use <domain> --table [schema.]table [--branch b] [--yes]puts a table's masks under a domain. Only that table is re-masked.fox mask key rotate <domain> [--yes]: the preview states the cost first (about 21 s per million rows, every hash changes, no undo). Then, on every running branch, table by table:Masked readers see the old masks until each table is done. Afterwards the new key replaces the old key's file, which deletes the old key.
fox mask setup --branchre-masks it.fox mask key drop <domain>deletes a domain no table uses. A stopped branch blocks the delete only if a table was put under the domain there, or the branch was made after the domain was.Console and API:
GET /api/masking/keysandPOST /api/masking/key, admins only, documented in openapi.yaml;mask.key.Found and fixed by the suite
A write already in flight when a table's masks were swapped could finish with trigger code that named the shadow just renamed away, and fail. The start, swap and repoint steps now briefly hold that table's writes first. Reads are not held. The hold is bounded, and retried if a long transaction is in the way.
Checked on a throwaway PostgreSQL 18 with 200,000 rows and six writers opening a new connection per write: no write refused, and every mask under the new key.
Tests
All in the fox-test VM, on the final code:
make integration: 811/811. The new §11aj covers:integration-v2: 403/403.integration-ui: 48/48, plus the upgrade test. The new key test makes a domain, moves a table, rotates the key, checks a domain in use is kept, then deletes it.integration-f5: 57/57;integration-f1: 70/70;integration-f6: 71/71.go vetfor macOS, Linux and Windows.Steps 3–5 follow: unmask and the audited lookup, the access-path suite, and masked branches.