fix: #131 use SecureRandom for default wallet id generator - #139
Open
edmoffo wants to merge 1 commit into
Open
Conversation
WalletsIn(Path) now seeds its randomizer with java.security.SecureRandom instead of java.util.Random. The 48-bit LCG output of the previous default is recoverable from a handful of observed samples, letting an observer enumerate upcoming wallet ids and race the existence check in create(). The two-arg constructor that accepts an explicit Random is untouched, so tests injecting deterministic generators stay unchanged. Closes zold-io#131
edmoffo
force-pushed
the
131-securerandom
branch
from
June 22, 2026 00:35
1c3cdb4 to
07dfb12
Compare
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.
The default constructor
WalletsIn(Path)was seeding wallet-id generation withnew java.util.Random(), the 48-bit LCG that #131 flagged as recoverable from a small handful of observed outputs. That let any observer of past ids enumerate upcoming ones and race the existence check on the nextcreate()call. The two-arg constructor that takes a caller-suppliedRandomwas kept untouched so deterministic test seeds stay unchanged.Switched the default to
new java.security.SecureRandom().SecureRandomextendsRandom, so the rest of the constructor chain and therandom.nextLong()call insidecreate()need no further adjustment. The change is two lines inWalletsIn.java: one new import and one swapped allocator.Local checks:
mvn -B test(68 tests, 0 failures, 5 skipped — same skipped set asmaster) andmvn -B -Pqulice -DskipTests verifyboth pass on this branch.Closes #131