Skip to content

wallet: Check existing seed before sharing - #81

Open
BenWestgate wants to merge 5 commits into
codex/restore-inconclusive-ripemd-sep30from
codex/30-existing-fingerprint-before-shares
Open

BenWestgate wants to merge 5 commits into
codex/restore-inconclusive-ripemd-sep30from
codex/30-existing-fingerprint-before-shares

Conversation

@BenWestgate

@BenWestgate BenWestgate commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Refs #30. Focused follow-up to #57 after #105, #99 and #80.

What and why

ms32 create --existing checks a supplied hex seed or codex32 master secret against the fingerprint on the separate wallet record before generating or showing a new recovery card. A mismatch can be corrected before a share ceremony begins. The explicit no-record path presents the recovered fingerprint and backup identifier for visual confirmation at the same early point. Wallet initialization receives the already checked result and does not prompt twice.

Ctrl-C or EOF during this early check reports that the existing backup remains valid. For a raw hex seed, the identifier shown during the no-record decision is the identifier used for the new shares and imported secret. Fresh ms32 create still asks the operator to record its newly generated fingerprint.

Review shape

Current head b2aafde is the same five focused #81 commits mechanically replayed directly onto refreshed #80 (3a35463), which sits on #99. The existing inline findings remain resolved.

Verification

All 303 CLI/Core tests pass normally and under python -O on the refreshed stack, including the early-record, mismatch, interruption, and no-record regressions. The exact-head GitHub matrices are green, git diff --check is clean, and Codex found no major issue on reviewed commit b2aafdeb40. The composed refreshed stack through #95 also passes all 941 tests normally and all 941 under python -O, plus Ruff, format, strict mypy, and correction-constant verification.

Human integration order is #57 → #105 → #99 → #80 → #81 → #95. The agent/Claude-authored commits need responsible-human review/rewrite or squash under repository policy before integration.

@BenWestgate BenWestgate added bug Something isn't working gate: adversarial review Resolve, merge, or explicitly defer before the next full adversarial review. area:wallet/core area:security labels Sep 30, 2026

@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: 1af1e2c951

ℹ️ 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 thread src/codex32/cli.py Outdated
@BenWestgate

Copy link
Copy Markdown
Owner Author

Current-head agent review ACK for 82d588e. I found no correctness or security blocker in this focused delta. The existing seed is parsed first, then the typed-record/no-record decision completes before CreationCeremony.from_secret() or _emit() can run; the checked expected fingerprint is carried into wallet initialization without a second prompt. The prior interruption P2 is resolved: Ctrl-C/EOF at this early gate now takes _WalletSetupInterrupted, preserving the existing recovery cards instead of telling the operator to void them.\n\nExact-head GitHub Python-package checks are green across the 3.12/3.13 OS matrix. I also rechecked py_compile and git diff --check at this head. A detached local pytest run cannot collect on this historical stack because it predates #7 and still imports the legacy bip32 test dependency; that is pre-existing branch history, not a #81 regression. Final integration should replay this focused delta after #42 → refreshed #57 → #46 (and the independent #80 delta as planned), then rerun the existing early-gate/identity/real-Core regressions on the final combined tip. The agent-authored 1af1e2c still needs the repository-required responsible-human rewrite/squash before integration.

@BenWestgate
BenWestgate force-pushed the codex/v1-pre-review-cleanup branch from 1899011 to 0793590 Compare October 1, 2026 01:33
@BenWestgate
BenWestgate force-pushed the codex/30-existing-fingerprint-before-shares branch from ff0f3b2 to 7d5ebfd Compare October 1, 2026 01:36
BenWestgate pushed a commit that referenced this pull request Oct 1, 2026
Reassign the expected_fingerprint argument instead of copying it into a
local, and give existing_secret its None default before the source
checks instead of in an else branch.

Behavior is unchanged. The installed package drops from 5161 to 5159
logical review lines, which keeps the integrated #7/#42/#57/#46/#80/#81
tip under the <5200 budget.

Security: the record gate still runs before any card is generated or
shown, and interrupts at that gate still raise _WalletSetupInterrupted.

Validation: ruff check, ruff format --check, mypy src/codex32, and
pytest (918 passed, with and without -O).

Refs #81, #38.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018az69UX4773mYohXAtE8kD

@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: 7d5ebfd518

ℹ️ 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 thread src/codex32/cli.py
@BenWestgate

Copy link
Copy Markdown
Owner Author

AI-assisted release-gate recheck at current head 37f6a25: the reviewer P2 is resolved. Raw hex create --existing now reuses the identifier chosen before the no-record decision as the new share-set identifier, so the safety screen, emitted shares, and finished/imported secret agree. The Codex32-input path remains unchanged because that input already carries a meaningful identifier. Production-flow verification exercised both shares and the finished secret; exact-head Python-package run 36803339842 is green, and all inline review threads are resolved. No remaining correctness blocker found in this focused early-record-gate delta. Agent-authored follow-ups still require responsible-human rewrite/squash before integration.

@BenWestgate
BenWestgate force-pushed the codex/30-existing-fingerprint-before-shares branch from 7686cb0 to aa2d333 Compare October 1, 2026 18:36
BenWestgate pushed a commit that referenced this pull request Oct 1, 2026
Backup creation rejects a noninteractive terminal before this branch, so the later stdin.isatty() rejection can never run. Removing it preserves the interactive behavior and leaves the integrated source under its strict review line budget. Refs #46 and #81.
@BenWestgate
BenWestgate changed the base branch from codex/remove-unreachable-v1-branches to codex/restore-inconclusive-ripemd-sep30 October 1, 2026 18:37
@BenWestgate
BenWestgate force-pushed the codex/restore-inconclusive-ripemd-sep30 branch from a29753e to 23a2c05 Compare October 1, 2026 22:14
BenWestgate pushed a commit that referenced this pull request Oct 1, 2026
Reassign the expected_fingerprint argument instead of copying it into a
local, and give existing_secret its None default before the source
checks instead of in an else branch.

Behavior is unchanged. The installed package drops from 5161 to 5159
logical review lines, which keeps the integrated #7/#42/#57/#46/#80/#81
tip under the <5200 budget.

Security: the record gate still runs before any card is generated or
shown, and interrupts at that gate still raise _WalletSetupInterrupted.

Validation: ruff check, ruff format --check, mypy src/codex32, and
pytest (918 passed, with and without -O).

Refs #81, #38.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018az69UX4773mYohXAtE8kD
@BenWestgate
BenWestgate force-pushed the codex/30-existing-fingerprint-before-shares branch from aa2d333 to 9f88b21 Compare October 1, 2026 22:15
BenWestgate pushed a commit that referenced this pull request Oct 1, 2026
Backup creation rejects a noninteractive terminal before this branch, so the later stdin.isatty() rejection can never run. Removing it preserves the interactive behavior and leaves the integrated source under its strict review line budget. Refs #46 and #81.

@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.

Exact-head release-gate re-review: ACK 9f88b21. ms32 create --existing now makes the wallet-record/no-record decision immediately after the supplied master seed is parsed, before any replacement card is generated or displayed; a mismatch/interruption cannot begin the sharing ceremony. The explicit no-record fallback remains, and raw-seed re-sharing reuses the identifier shown at that safety screen. The two later follow-ups are also sound: identifier reuse fixes the safety-screen/output mismatch, and the removed stdin guard is unreachable after the command preflight. The combined stack passes 935 tests normally and under python -O; focused create-existing/identity tests pass and the final tip remains 5,193 <5200. No code blocker found. Agent/Claude-authored commits still require responsible-human rewrite/squash before integration.

@BenWestgate
BenWestgate marked this pull request as ready for review October 2, 2026 00:30
@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.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@BenWestgate
BenWestgate force-pushed the codex/restore-inconclusive-ripemd-sep30 branch from 23a2c05 to a0ab769 Compare October 2, 2026 08:58
BenWestgate pushed a commit that referenced this pull request Oct 2, 2026
Reassign the expected_fingerprint argument instead of copying it into a
local, and give existing_secret its None default before the source
checks instead of in an else branch.

Behavior is unchanged. The installed package drops from 5161 to 5159
logical review lines, which keeps the integrated #7/#42/#57/#46/#80/#81
tip under the <5200 budget.

Security: the record gate still runs before any card is generated or
shown, and interrupts at that gate still raise _WalletSetupInterrupted.

Validation: ruff check, ruff format --check, mypy src/codex32, and
pytest (918 passed, with and without -O).

Refs #81, #38.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018az69UX4773mYohXAtE8kD
BenWestgate pushed a commit that referenced this pull request Oct 2, 2026
Backup creation rejects a noninteractive terminal before this branch, so the later stdin.isatty() rejection can never run. Removing it preserves the interactive behavior and leaves the integrated source under its strict review line budget. Refs #46 and #81.
@BenWestgate
BenWestgate force-pushed the codex/30-existing-fingerprint-before-shares branch from 9f88b21 to 1d5b6f5 Compare October 2, 2026 08:59
@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.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@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.

Codex current-head release-gate re-review: ACK 1d5b6f5.

ms32 create --existing now makes the wallet-record/no-record decision before any replacement card is generated or displayed. The two prior correctness findings remain fixed: Ctrl-C/EOF at that early gate preserves the existing backup, and raw-hex re-sharing reuses the identifier shown at the safety screen for the resulting share set. Both inline threads are resolved, and exact-head Python-package run 664 succeeded.

No code blocker found. The agent/Claude-authored commits still require responsible-human rewrite/squash before integration.

Codex Agent and others added 5 commits October 5, 2026 00:11
An existing hex seed or codex32 master secret previously reached the wallet-record fingerprint check only after new recovery cards had been generated and confirmed. Check the typed record immediately after parsing the source, before any card output or ceremony. Preserve the explicit recordless path at the same early decision point, and pass the checked result through to wallet initialization so it is not prompted twice. Cover matching, mismatching, and recordless flows for both source encodings. Refs #30.
Translate Ctrl-C or EOF at the early wallet-record gate for ms32 create --existing into the existing wallet-setup interruption path. This keeps an operator from being told to invalidate a pre-existing recovery card before any new share ceremony has started.

Add a focused regression proving the interruption occurs before share creation or output and preserves the valid-backup message.
Reassign the expected_fingerprint argument instead of copying it into a
local, and give existing_secret its None default before the source
checks instead of in an else branch.

Behavior is unchanged. The installed package drops from 5161 to 5159
logical review lines, which keeps the integrated #7/#42/#57/#46/#80/#81
tip under the <5200 budget.

Security: the record gate still runs before any card is generated or
shown, and interrupts at that gate still raise _WalletSetupInterrupted.

Validation: ruff check, ruff format --check, mypy src/codex32, and
pytest (918 passed, with and without -O).

Refs #81, #38.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018az69UX4773mYohXAtE8kD
A raw seed imported with create --existing was assigned a temporary random identifier for the no-record safety screen, then assigned a different random identifier when the new share set was created. Reuse the first identifier as the share-set identifier so the safety screen describes the backup that will actually be produced.\n\nExtend the recordless-creation regression to require the displayed, emitted, and imported identifiers to agree.\n\nRefs #30
Backup creation rejects a noninteractive terminal before this branch, so the later stdin.isatty() rejection can never run. Removing it preserves the interactive behavior and leaves the integrated source under its strict review line budget. Refs #46 and #81.
@BenWestgate
BenWestgate force-pushed the codex/30-existing-fingerprint-before-shares branch from 1d5b6f5 to b2aafde Compare October 5, 2026 05:16
@BenWestgate
BenWestgate force-pushed the codex/restore-inconclusive-ripemd-sep30 branch from a0ab769 to 3a35463 Compare October 5, 2026 05:16

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: b2aafdeb40

ℹ️ 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 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 current-head review: ACK b2aafde. Existing-seed identity is checked before any new card output; mismatch, interruption, no-record, and raw-seed identifier paths are covered. Exact-head package CI is green.

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

area: security Security invariants, hardening, and security-sensitive boundaries. area: wallet/core Wallet integration and Bitcoin Core boundaries. bug Something isn't working gate: adversarial review Resolve, merge, or explicitly defer before the next full adversarial review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants