Repository navigation
fix: persist Redis with a synced AOF and update the spec - #162
Merged
Merged
Conversation
SPECIFICATION.md 6.2 forbids persistent storage, but the default compose stack snapshotted Redis to a named volume, so ciphertext, verification hashes and delete tokens could stay on disk after a burn. Disable RDB and AOF and drop the volume in both compose files and the `pnpm redis` script. The image snapshots by default, so removing `--save` alone would not be enough. Document that a Redis restart now drops unexpired secrets and queued webhooks, and how to remove an old volume.
Memory-only Redis met the spec but lost every unexpired secret on any restart. Snapshots kept data across clean restarts, but a crash could bring back a secret burned since the last snapshot. Use an AOF synced before each write is acknowledged, so secrets survive restarts and an acknowledged burn survives a crash. Update the spec to allow this and forbid recovering from snapshots, and correct the security copy that claimed no persistent storage. Document the upgrade steps, because Redis ignores an existing dump.rdb once AOF is on. Dev setups stay memory-only.
# Conflicts: # SPECIFICATION.md
"No persistent storage" conflated two guarantees. A deleted entry must never be released, with no races and across crash recovery. It must also be purged as soon as the backing store can manage at scale, and data still on disk is acceptable until then. Keep the requirements store-agnostic so other adapters can be added, and move the Redis settings under the adapter requirements.
Merged
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
SPECIFICATION.md6.2 said "Implementation MUST NOT use persistent storage", but the default Docker deployment snapshotted Redis to a named volume. Rather than dropping persistence, which loses every unexpired secret on any Redis restart, this switches to a durable AOF and changes the spec to match.Snapshots were the worst of both: a crash lost recent secrets and could also bring back a secret burned since the last snapshot. With
appendfsync always, a burn is on disk before the recipient gets the secret.docker-compose.yaml:--appendonly yes,--appendfsync always,--save '',--auto-aof-rewrite-min-size 1mb, and theredis_datavolume stays.SPECIFICATION.md2.1, 6.2, 7.1: replaces "no persistent storage" with two separate, store-agnostic deletion guarantees. A deleted entry MUST NOT be released: release and delete are one atomic operation, including across crash recovery. A deleted entry MUST be purged: the store releases references as soon as is possible at scale, and data still on disk is acceptable until then as long as the API cannot return it. Redis specifics (AOFalways, no RDB save points) move under the adapter requirements, leaving room for PostgreSQL or SQLite adapters.security.*.storagecopy in all 5 locales: "No persistent storage of sensitive information" is no longer true, so it now says what does reach disk. Translations are mine and could use a native check.README.md: explains persistence, operator responsibilities and upgrade steps.packages/server/docker-compose.yaml,pnpm redis): memory-only, which the spec allows. Dev data is disposable and this avoids slow writes, but dev Redis no longer keeps data across restarts.Just pulling this and running
docker compose up -dloses all unexpired secrets. Redis ignoresdump.rdbonce AOF is on, and that snapshot then stays on disk. Runconfig set appendonly yeson the live Redis before upgrading. The README has the full steps, and they were tested.Trade-offs
redis-benchmarkSET test on Docker Desktop for Windows: 273 req/s at p50 3.9 ms withalways, against 8,065 req/s at p50 0.11 ms witheverysec. Real disks will differ.ENCRYPTION_KEY.Testing
Run against the built root stack unless noted:
docker compose configis valid for both compose files.docker kill(SIGKILL) straight after a burn, the burned secret stayed gone, and the unburned secret survived with its TTL intact.BGREWRITEAOF, the kept secret stayed, and it survived a further SIGKILL and reload.dump.rdband restarting.example.comwere rejected and logged as failed, which is expected for that target.packages/servertests: not run locally, because they hardcodelocalhost:6379, which another process holds here. CI runs them.format:checkpass. All 47 tests pass with an explicit--testMatch, because the configured pattern finds no tests from this dot-directory worktree path. CI runs them normally.Not tested:
pnpm redisitself was not run, so its\"\"quoting hasn't been exercised through pnpm's shell. Please run it once.Not in this PR
deletionline ("Secure deletion of data…") and the landing page's "Ephemeral by default" are unchanged. They still read as accurate alongside the new line, but deserve a look.