Skip to content

wallet: Require the recorded fingerprint before import - #57

Open
BenWestgate wants to merge 1 commit into
reviewability-v1from
30-recorded-fingerprint-gate
Open

BenWestgate wants to merge 1 commit into
reviewability-v1from
30-recorded-fingerprint-gate

Conversation

@BenWestgate

@BenWestgate BenWestgate commented Sep 24, 2026 •

Copy link
Copy Markdown
Owner

Fixes #30. Library/CLI half of #26; GUI half is #28.

This adds the restore-time wallet identity gate before Bitcoin Core mutation.

  • BitcoinCore.initialize() accepts an expected fingerprint and checks it before wallet selection, unlock, creation or import.
  • ms32 wallet requires the fingerprint from the wallet record; mismatch retries without changing Core.
  • ms32 create --existing uses the same restore gate, including after re-sharing.
  • With no wallet record, the CLI shows the recovered fingerprint, backup identifier and whether the identifier matches the codex32/Bails/Bails-alpha seed-derived rule, then requires the explicit warning/confirmation path.
  • Fresh ms32 create only records the new fingerprint; it has no pre-existing wallet identity to authenticate.
  • parse_fingerprint() accepts 8 hex digits in any case or spacing.
  • Core smoke/regtest tools pass the restore fingerprint where required.

#28 carries the same library/Core boundary plus the GUI flow. #43 tracks checksummed wallet-record fields; #55 tracks the seed-keyed encrypted descriptor backup; #56 tracks identifier-assisted correction ranking.

The branch is now one human-authored commit (dcc0d41) directly on current reviewability-v1 head cf1a599: one commit ahead, zero behind. It preserves the exact functionally ACKed recovery-gate file contents from 795ccdd while retaining #15's license-notice base changes and removing the AI-authored/co-author-trailer history flagged by review. The rewritten head must complete its fresh GitHub Actions run before merge.

The existing-seed regression test covers both an unchanged secret and re-sharing before import.

@BenWestgate BenWestgate added area: cli Command-line interface behavior. area: security Security invariants, hardening, and security-sensitive boundaries. area: wallet/core Wallet integration and Bitcoin Core boundaries. gate: adversarial review Resolve, merge, or explicitly defer before the next full adversarial review. labels Sep 24, 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: 5eaf535bb7

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

Copy link
Copy Markdown
Owner Author

Contract clarification applied in b50321a: ms32 create no longer treats the new fingerprint as authentication evidence or asks the user to type it back. It only requires acknowledging that the fingerprint was written on the wallet record. ms32 wallet retains the fingerprint/no-record restore gate. 886 normal + 886 optimized tests pass.

@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: 6da1f2a416

ℹ️ 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 docs/security/invariants.md

@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-generated review (Claude), posted at the maintainer's request. I wrote 5eaf535, so this is partly self-review.

Not ACKing 6da1f2a.

  • 6da1f2a removes identifier_origin/identifier_note, which the no-record path was built to show. If that's intended, invariants.md:16-18 and model.md:232 still promise it (agree with the Codex P2). If not, revert it. Either way #57 now differs from #28, which keeps them.
  • Policy: 6da1f2a is authored by Codex Preflight <codex-preflight@localhost>, and AI_POLICY.md forbids agent authors. Its message also contains a literal \n\n and has no area prefix. 5eaf535 has a Co-Authored-By: Claude trailer, which the same policy forbids. Squash-merge or reword.
  • Q: create --existing imports an existing seed (timestamp 0) with restore=False, so it skips the fingerprint gate. Should it pass restore=True? The Enter-if-none path keeps it usable.

@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-generated review, posted at the maintainer's request.

Concept ACK 70a188a. The no-record identifier evidence is restored and matches #28 again.

One correctness item remains: ms32 create --existing supplies an existing seed but still reaches _initialize_wallet(..., restore=False), so it can import without the wallet-record gate. Treat --existing as a restore for wallet initialization.

@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-generated review, posted at the maintainer's request.

ACK 795ccdd. Existing-seed initialization now uses the same restore gate before import, including after re-sharing; identifier evidence remains aligned with #28. Full Python package matrix is green.

Copy link
Copy Markdown
Owner Author

Release-gate verification at current head 795ccdd: the authoritative Core boundary calls verify_identity(secret, expected_fingerprint) before _select(), so mismatch occurs before wallet listing/selection, unlock, creation, or descriptor import. The focused regression test_identity_mismatch_stops_before_any_wallet_call asserts the mismatch and rpc.calls == []. The current Python package workflow run 36284182340 completed successfully. This satisfies the verify-before-mutate accident-safety finding for the CLI/library subset; #55 remains the separate malicious-tampering/descriptor-backup design.

Copy link
Copy Markdown
Owner Author

One non-code release-gate item still remains despite the code ACK: the current PR history still contains 5eaf535 with a Co-Authored-By: Claude trailer and 6da1f2a authored/committed by Codex Preflight. docs/developer/AI_POLICY.md says not to include agents as authors or co-authors. Before merge, squash/reword/rebase this branch under the responsible human author while preserving the current 795ccdd tree, then rerun the green package workflow on the rewritten head.

Copy link
Copy Markdown
Owner Author

Release-gate history check: the functional fix is ACKed at 795ccdd, but the commit-policy condition from the earlier review still remains. The branch history still contains 5eaf535 with a Co-Authored-By: Claude ... trailer and 6da1f2a authored by Codex Preflight <codex-preflight@localhost> (later behavior commits correct the code, but do not remove those history records). Before merge, rewrite/squash so the retained release commit is authored by the responsible human and follows AI_POLICY.md. Functionally, the verify-before-mutate boundary and existing-seed restore gate are green.

@BenWestgate
BenWestgate force-pushed the 30-recorded-fingerprint-gate branch from 795ccdd to 53cd58b Compare September 27, 2026 03:21
@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.

Check the recorded master fingerprint before any wallet selection, unlock, creation, or descriptor import. Apply the same restore gate to `ms32 wallet` and `ms32 create --existing`, including re-sharing; fresh creation only records the newly created identity.

Without a wallet record, show the recovered fingerprint, backup identifier, supported codex32/Bails identifier evidence, and the explicit no-record warning before mutation.

Security: this is the release-gate accident-safety boundary for wrong or mixed recovery material. Malicious replacement resistance remains the separate authenticated-descriptor work in #55.

Validation on the identical recovery-gate files from the functionally ACKed head: full Python package matrix green; focused mismatch tests prove no Core RPC mutation occurs before identity verification. Rebased onto the current license-notice base without changing those recovery-gate files.

Fixes #30. Refs #26.
@BenWestgate
BenWestgate force-pushed the 30-recorded-fingerprint-gate branch from 53cd58b to dcc0d41 Compare September 27, 2026 03:22
@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.

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: cli Command-line interface behavior. area: security Security invariants, hardening, and security-sensitive boundaries. area: wallet/core Wallet integration and Bitcoin Core boundaries. 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.

1 participant