Repository navigation
docs(guides): add a guide for moving off CipherStash - #113
Open
calvinbrewer wants to merge 2 commits into
Open
calvinbrewer wants to merge 2 commits into
calvinbrewer wants to merge 2 commits into
Conversation
Add /guides/moving-off-cipherstash, the reverse of the data migration guide: add plaintext columns, dual-write, resumable bulkDecrypt backfill, verify coverage, switch reads, drop encrypted columns, optionally uninstall EQL. Covers the EQL domain to Postgres type mapping, index replacement, Proxy/Drizzle/Prisma differences, lock contexts, and the ZeroKMS dependency. Add a Bulk operations section to the Stack usage reference for bulkEncrypt, bulkDecrypt, bulkEncryptModels, and bulkDecryptModels, and correct the schema import in the usage example. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
freshtonic
approved these changes
Oct 21, 2026
freshtonic
left a comment
There was a problem hiding this comment.
Nice work.
Potential follow-up for this - should we have a test that validates an agent can follow the instructions?
tobyhede
approved these changes
Oct 21, 2026
This branch was successfully deployed
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.
Summary
Adds
/guides/moving-off-cipherstash, the reverse of/guides/migration.bulkDecryptbackfill script (Stack SDK +pg), with a per-value failure path and anIS NULLguard against racing live writes. The guide says the CLI has no reverse-migration command yet and that the page will describe one when it exists. It documents no CLI command that does not exist./reference/stack/usagehad no bulk documentation, so this adds a "Bulk operations" section (bulkEncrypt,bulkDecrypt,bulkEncryptModels,bulkDecryptModels). The generated TypeDoc API reference is not in the repo, so the section is hand-written.content/docs/guides/meta.json, a cross-link from/guides/migration, and anIA.mdchecklist entry.One deviation from the issue's step list: I added a dual-write step before the backfill. It mirrors the forward migration, and without it any row written after the backfill passes it is uncovered. The guide says to skip it only if all writers can be paused.
Verified against source
SDK and CLI (
cipherstash/stackat6ed8a232b,@cipherstash/stack1.1.1):bulkDecrypt(payloads): payloadArray<{ id?, data: Encrypted | null }>, returnsResult<Array<{ id?, data } | { id?, error }>>; input order preserved; nulls skipped and returned asdata: null; empty input returns[]; per-value errors via the fallible FFI primitive (encryption/index.ts,operations/bulk-decrypt.ts,types.ts).bulkDecryptModels(models, table, lockContext?)returns oneResultwith no per-value entries; the lock context is positional or chained, not both (encryption/client-v3.ts,operations/mapped-decrypt.ts).bulkDecryptdoes noDatereconstruction; dates come back as stored strings (client-v3.ts,skills/stash-encryption)..withLockContext({ identityClaim })is accepted bybulkDecrypt; it needs anOidcFederationStrategyclient; one client per user because the strategy caches a token;AccessKeyStrategyis invalid; the WASM entry has no lock context (identity/index.ts,skills/stash-auth,skills/stash-zerokms).Encryption,encryptedTable,typesis@cipherstash/stack/v3;OidcFederationStrategyis exported from the package root (src/index.ts,src/encryption/v3.ts, also at the 1.0.0 tag).packages/test-kit/src/catalog.ts,packages/eql/src/v3domain list, existing EQL reference pages). Index extractor recipes from the existing/reference/eql/indexespage.DROP SCHEMA IF EXISTS eql_v3 CASCADE; DROP SCHEMA IF EXISTS eql_v3_internal CASCADE;, andpublic.eql_v3_*domains and the columns typed with them survive (packages/eql/tasks/uninstall-v3.sql,tests/sqlx/tests/v3_uninstall_tests.rs,packages/eql/README.md).unnestbatch update,IS NULLguard,bigint/date/numeric/boolean/jsonb/timestamptzarray casts, resume, per-value failure, exit code) was run against a real Postgres 15 with a stubbedbulkDecrypt. The catalog queries in the uninstall step were also run against Postgres.Batch size: the issue says default 500. Confirmed in
cipherstash-client0.42.2 (the versionprotect-ffipins):DEFAULT_KEYS_PER_REQ = 500,DEFAULT_CONCURRENT_REQS = 5, decrypt groups payloads by keyset and chunks each group at that size.protect-ffidoes not override either default. The SDK itself has no batch-size option; a call with more than 500 values is split by the client, not rejected. The guide words this as "up to 500 values per request by default".Not verified or taken from the issue
apps/dashboard/autumn.config.tsincipherstash-js-suite, which tracksdecryption_operationswith a 1 trillion/month grant on every plan. Please confirm the wording with whoever owns pricing.numeric/real/doubleas JavaScriptnumber. The guide warns about precision loss beyond a double and tells readers to compare against their system of record. I did not test precision behavior.varchar(n),numeric(p,s),timestampvstimestamptz, orjsonvsjsonb. The guide tells readers to take these from their pre-encryption schema.bulkDecryptbatch (per-valueerrorvs whole-callfailure) is not confirmed from source, so the guide does not claim either.SELECTreturns the raw payload). The column-swap option is a Postgres technique, not something I ran against Proxy./reference/stack/usageimportedencryptedColumn/encryptedTablefrom@cipherstash/stackand used.equality(). The package root exports neither (also true at the 1.0.0 tag). I changed it to@cipherstash/stack/v3withtypes.TextEq("email")so the new bulk section can reuseusersandencryption. Other pages, such as thewasm-inlineimport line in the Supabase edge-functions page, may have the same problem; I did not audit them.Checks
bun run types:check: passes.bun run validate-content: passes.bun run lint: my files are clean. Two pre-existing format errors remain onorigin/main(content/docs/security/meta.json,scripts/fixtures/stash-manifest.json).bun run validate-links: no findings for the new or edited pages except/reference/stack/api-reference, which is generated at prebuild (generate-docsclones from GitHub) and is absent locally, as for every other page that links to it. I did not run the fullnext buildbecause itsprebuildneeds network.Closes #107
Linear: https://linear.app/cipherstash/issue/CIP-4166
🤖 Generated with Claude Code