Skip to content

create: Draw randomness from Core and OS - #201

Open
BenWestgate wants to merge 2 commits into
codex/entropy-source-apifrom
codex/core-entropy-integration
Open

BenWestgate wants to merge 2 commits into
codex/entropy-source-apifrom
codex/core-entropy-integration

Conversation

@BenWestgate

Copy link
Copy Markdown
Owner

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 cover RAM-backed storage, disk fallback and leaked-wallet limits.

Validation: 347 Core/CLI/generation tests pass; git diff --check passes. The same implementation was independently security-reviewed before this split, including a 22/22 Linux/Core 32.0rc4 run; obtain a current-head review for this rebased commit.

This replaces the oversized review unit in #145.

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.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T09:14:52.568193Z fed972d New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@BenWestgate BenWestgate left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-assisted review. ACK 0d5df21 (static code/security review). Nine changed files reviewed; no reportable security findings. CI is green. I did not independently rerun the live Bitcoin Core regtest.

@BenWestgate
BenWestgate added this pull request to stack #206 October 24, 2026 14:27

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d5df2128b

ℹ️ 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".

Comment on lines +560 to +563
if self._folder:
shutil.rmtree(self._folder, ignore_errors=True)
detach = ("/usr/bin/hdiutil", "detach", "-force", self._disk)
if self._disk and not subprocess.run(detach, capture_output=True, check=False).returncode:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Defer interrupts until filesystem cleanup finishes

If Ctrl-C, SIGHUP, or SIGTERM arrives during rmtree or the macOS detach subprocess, KeyboardInterrupt escapes immediately: only the preceding RPC cleanup catches it. On the successful-draw path, __call__ does not retry _close(), so the encrypted wallet can remain undeleted or the RAM disk can remain mounted, and the CLI prints only the generic interruption message without identifying the leftover resource. Catch and defer interruptions throughout filesystem cleanup as well, completing or reporting each cleanup step before propagating the interruption.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cACK. This is fixed with interruption tests in stacked #203 (6efe9c1). #201 must not merge alone before #203; keeping this thread open until the fix is integrated.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant