Repository navigation
feat(server): protect verification hash and delete token at rest - #164
Merged
Merged
Conversation
A Redis dump exposed `h` and `dt` in plaintext, which was enough to burn or delete a secret and gave legacy password links a fast offline guessing oracle. Store `h` as an HMAC-SHA256 digest keyed from ENCRYPTION_KEY and bound to the vault ID. The digest is deterministic, so the Lua script still compares atomically and no distributed lock is needed. The stored format selects the comparison, so a stolen digest can't be submitted as `h`. Encrypt `dt` rather than digesting it because webhook payloads return the original value to the creator. Existing entries keep working until they expire. Closes #69
dillonstreator
force-pushed
the
claude/issue-69-investigation-ec1af4
branch
from
November 6, 2026 22:24
56b7183 to
1ff0ad8
Compare
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.
Closes #69
Problem
Redis stored the verification hash
hand delete tokendtin plaintext. Someone holding a dump but notENCRYPTION_KEYcould:htoGET /vault/:id, using up a read or burning the secret and firing a falseREADwebhookdtto delete any secretChanges
h: stored ashm1:+ HMAC-SHA256, keyed through HKDF fromENCRYPTION_KEYand bound to the vault ID. The digest is deterministic, so the Lua script is unchanged and reads stay atomic. No distributed lock is needed.dt: encrypted withmachine.encrypt, not digested, because webhook payloads return the original value to the creator.The API and clients are unchanged.
Review notes
h.handdtkeep working until they expire. The fallback can be removed once this has been deployed for the 7-day max TTL.ENCRYPTION_KEY: every unexpired entry written after this change now returns a 500 until it expires or the old key is restored, not only those with IP or webhook options. Attempts aren't counted, so nothing burns.Not covered
ENCRYPTION_KEY.c,m,cd,ttl, the counters andwh.nstay in plaintext. A dump plus the URL key still allows password guessing againstc, at the content layer's Argon2id cost.Testing
dtand key changes.--testMatchbecausepnpm testfound no tests in this Windows worktree path.pnpm test:e2ewas not run locally.One local server run failed after about 34 seconds, and the reason was cut off by filtered output. A later run hit
ECONNRESETafter the local Redis container was restarted on the same port, and 7 further runs passed. A connection problem is likely but unconfirmed for the first failure.