fix(keystore): clamp unlock timeout and zeroize cached identities#467
Closed
ouicate wants to merge 2 commits into
Closed
fix(keystore): clamp unlock timeout and zeroize cached identities#467ouicate wants to merge 2 commits into
ouicate wants to merge 2 commits into
Conversation
Cap walletpassphrase unlock duration at 100,000,000 seconds to match Bitcoin Core, and ensure native age identity secret keys are zeroized on drop when the keystore locks or auto-relocks. Co-Authored-By: Composer <noreply@cursor.com>
Contributor
Author
|
Please review @nullcopy |
nullcopy
requested changes
Jul 17, 2026
nullcopy
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the suggestions. The ideas are good, but I would prefer different solutions.
-
capping the timeout to 100K secs to match Bitcoin. This does prevent a panic if the caller specifies an unlock time large enough to trigger overflow. Rather than silently falling back to an unlock time the caller did not request, I would prefer to just do
checked_add()and return an error to the caller if their requested unlock time is too large, and allow them to try again with a smaller value. -
the helper to clear cached identities is unnecessary. Simply enabling the
zeroizedfeature accomplishes the stated goal.
Contributor
|
Superseded by #641 |
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
walletpassphraseunlock duration at 100,000,000 seconds, matching Bitcoin Core'swalletpassphrasebehavior.x25519-dalek'szeroizefeature so native age identity secret keys are overwritten when cached identities are dropped duringwalletlockor auto-relock.Vec::clear()withclear_cached_identities()that drains identities and releases theVecallocation viashrink_to_fit().Addresses GHSA-49gv-v767-5q9w.
Motivation
KeyStore::unlockacceptedtimeoutvalues up tou64::MAX, allowing RPC callers to disable auto-relock for effectively forever. Separately,agedepends onx25519-dalekwithout thezeroizefeature, so native identity secret keys were not guaranteed to be overwritten when identities were cleared from the in-memory cache.