Repository navigation
create: Draw randomness from Core and OS - #145
BenWestgate wants to merge 2 commits into
Conversation
02e1f72 to
06ff2d3
Compare
|
@codex security-review Generated by Claude Code |
Summary
Testing
|
|
@codex we don't see the changes you speak of. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
cACK # Hashing keeps the plaintext xpub in the wallet file from checking guesses of a share. The question then becomes, how much entropy is in an xprv and why SHA256 instead of another hash function for example SHA512? And why just one round? |
Summary
Testing
|
BenWestgate
left a comment
There was a problem hiding this comment.
Security review of 40fb74f (PR #145; 13 changed files).
[P2] Treat failure to unload the entropy wallet as a creation failure. In CoreEntropy.close(), unloadwallet errors are reduced to a warning, _folder/_disk are cleared before cleanup succeeds, and rmtree(..., ignore_errors=True) hides filesystem removal failures. _create() can consequently report a successful ceremony (or proceed to wallet initialization) while the entropy wallet remains loaded in Bitcoin Core; callers also lose the state needed to retry cleanup. The source xprvs held in that wallet determine all the generated entropy. Although the wallet is normally relocked after each draw, combined failures of walletlock and unloadwallet can leave the keys RPC-accessible during the 60-second unlock window. Propagate unload failure after best-effort cleanup, preserve failed resource handles for retries, and test this at the CLI boundary. The current unit test explicitly expects a warning and successful close() on unload failure.
Other security boundaries reviewed: Bitcoin Core selection and stdin-only passphrase handling; 256-bit passphrase generation; SHA-256 extraction from each fresh xprv to prevent stored public xpubs from testing guesses of shares; explicit source injection and byte-count checks; unbiased index rejection sampling; confirmation-gated shares; OS-specific RAM/disk paths and signal cleanup. SHA-256 is appropriate here: one invocation already provides 256-bit preimage resistance, and SHA-512 or repeated hashing cannot increase entropy beyond the source. No other actionable vulnerability was identified in these paths.
CI: 10 Python test-matrix jobs and 1 Bitcoin Core fixture job passed. The managed local diff scanner could not start because head 40fb74f is not available in the local Git object database; this review inspected GitHub's exact PR patches and head-revision source. Recommendation: revise before merge and re-review wallet teardown.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
1 similar comment
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d20d70dd00
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
BenWestgate
left a comment
There was a problem hiding this comment.
AI-assisted current-head security/code review.
Concept ACK bea2914; not a security ACK yet. Seed, share, index and identifier draws now require injected entropy; each SHA-256 draw combines fresh Core xprv material with independent OS bytes, with no silent fallback on Core failure. Wallet cleanup and interruption handling have tests. Before human approval: independent real-Core 32.0rc3 verification of repeated draws, interruption/unload, disk-fallback warning and secret-file removal, plus security review of the new CoreEntropy boundary.
|
This is the real-Core check the review above asks for, run on
Not covered: the macOS RAM disk and Windows against real Core. CI covers those paths only with fakes. I wrote both the change and this check, so it isn't independent. The script is about 250 lines and could go under Generated by Claude Code |
|
cACK: The script is about 250 lines and could go under tools/ if you want it rerunnable here. Yes. |
|
Do the commits follow contributing.md? |
bea2914 to
7cb2ae6
Compare
|
The 14-commit history contained repeated fixups and reversals, so it needed consolidation under CONTRIBUTING.md's squashing guidance. It is now one atomic commit, Verified All six inline threads are resolved. The approved standalone verification script is still absent from the branch, so the PR description now explicitly tracks that request and independent security review as remaining work. This history cleanup does not supply either. |
BenWestgate
left a comment
There was a problem hiding this comment.
AI-assisted incremental review at 753eded: Code ACK for the follow-up test/CI changes. The standalone 22-check Core entropy harness is committed, the workflow installs codex32 before calling its CLI, and both current-head CI jobs passed. Independent security review of CoreEntropy and real-Core macOS/Windows coverage remain outstanding. Not a security/merge ACK.
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
BenWestgate
left a comment
There was a problem hiding this comment.
AI-assisted independent security review at 753eded: 22/22 entropy harness checks passed on real Bitcoin Core 32.0rc4 (Linux regtest), including fresh draws, per-draw wallet cleanup, interruptions, disk fallback and log checks. No confirmed vulnerability in the 15-file diff. Linux Core boundary verified; full Tails creation/restore and macOS/Windows runtime coverage remain open. Not yet a merge ACK.
|
Not going to code review +842
I cACK the description and most of the approach but you need to make this easier to review somehow. |
Route every random draw through a caller-provided entropy function and validate its byte count. Keep current CLI behavior by passing the OS CSPRNG explicitly, so the Core-backed source can be reviewed separately. Update generation tests, the installed-wheel smoke test, and API documentation for the new boundary.
Use CoreEntropy for every fresh CLI draw, mixing a fresh Bitcoin Core xprv with independent OS bytes and failing closed when Core or cleanup fails. Keep temporary wallet keys encrypted, relock and unload each draw, convert termination signals into cleanup interruptions, and document the trust and disk-fallback boundaries. Add Core adapter, CLI, cleanup, interruption, and regtest coverage.
753eded to
0d5df21
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Use the injected entropy boundary from #200 to source every fresh CLI draw from
CoreEntropy: hash a fresh Bitcoin Core xprv with 32 independent OS-random bytes, and fail closed if Core or temporary-wallet cleanup fails.The temporary wallet is encrypted, relocked and unloaded for each draw. Supported termination signals become cleanup interruptions before another card is emitted. Security/user docs describe RAM-backed storage, disk fallback and leaked-wallet limits.
Validation: 347 Core/CLI/generation tests pass on the rebased split;
git diff --checkpasses. The implementation was independently security-reviewed before the split, including a 22/22 Linux/Core 32.0rc4 run; the new head still needs a current-head review after this rebase.The standalone verification harness and CI are split into a separate stacked PR.