Skip to content

bip93: Reject non-ASCII before normalization - #13

Open
BenWestgate wants to merge 4 commits into
codex/63-private-core-descriptorsfrom
codex/v1-ascii-normalization
Open

BenWestgate wants to merge 4 commits into
codex/63-private-core-descriptorsfrom
codex/v1-ascii-normalization

Conversation

@BenWestgate

@BenWestgate BenWestgate commented Sep 21, 2026 •

Copy link
Copy Markdown
Owner

Reject non-ASCII identifiers, indices, derivation targets and recovery input before whitespace removal or case folding. CLI input ends the command with an ASCII error; library confirmation raises an error. ASCII case and grouping remain supported.

This prevents Unicode characters from becoming valid Bech32 text during normalization. The ASCII-only folding helper and Unicode retry handling have been removed, as requested in review.

Validation at 32db210: all 954 tests pass normally and under Python -O; Ruff lint/format, mypy and whitespace checks pass. Current-head CI remains under review. Adapts Rob1Ham#9.

@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: 364e3d5060

ℹ️ 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/generation.py Outdated
Comment thread src/codex32/generation.py
@BenWestgate
BenWestgate force-pushed the codex/v1-ascii-normalization branch from 364e3d5 to b064fb5 Compare September 21, 2026 09:39
@chatgpt-codex-connector

This comment has been minimized.

@BenWestgate

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: b064fb5aa2

ℹ️ 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/generation.py Outdated

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

LGTM, outside of the nit codex found

@BenWestgate BenWestgate added gate: adversarial review Resolve, merge, or explicitly defer before the next full adversarial review. bip93 BIP93 encoding, checksum, parsing, and format rules. bug Something isn't working labels Sep 24, 2026

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

ACK 1b17d8a, one nit.

  • ASCII checks land before every .lower() on header/index/target/confirmation input; bech32_decode was already guarded by _validate_single_case_ascii.
  • Merges cleanly with #11 and #33.

Comment thread src/codex32/generation.py Outdated

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

@BenWestgate BenWestgate added the correction Correction engine and correction UX. label Sep 30, 2026 — with ChatGPT Codex Connector

Copy link
Copy Markdown
Owner Author

Agent release-gate review at exact head d2f8589: the Unicode-normalization fix closes the Kelvin-sign/lookalike boundary consistently. Non-ASCII identifiers, indices, derivation targets and raw CLI headers are rejected before normalization; confirmation folds ASCII case only, so Unicode lookalikes cannot alias valid card text while ordinary ASCII case-insensitive confirmation remains intact. Exact-head Python-package run 36361133118 succeeded. No remaining code-review blocker found. The duplicated ASCII-only lower helper is appropriately deferred to #53's final API-boundary refresh.

@BenWestgate
BenWestgate force-pushed the codex/v1-ascii-normalization branch from d2f8589 to 4f24148 Compare October 1, 2026 18:52
@BenWestgate
BenWestgate changed the base branch from reviewability-v1 to codex/v1-core-state-validation October 1, 2026 18:52
@chatgpt-codex-connector

This comment has been minimized.

1 similar comment
@chatgpt-codex-connector

This comment has been minimized.

@BenWestgate
BenWestgate force-pushed the codex/v1-ascii-normalization branch from 4f24148 to 49f5cdc Compare October 1, 2026 19:08
@chatgpt-codex-connector

This comment has been minimized.

@BenWestgate
BenWestgate force-pushed the codex/v1-ascii-normalization branch from 49f5cdc to 4f01561 Compare October 2, 2026 00:42
@chatgpt-codex-connector

This comment has been minimized.

@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 re-review: ACK 4f01561.

The current diff rejects non-ASCII lookalikes before header/index/target normalization and uses ASCII-only case folding in the common card-confirmation path, so characters such as Kelvin sign cannot normalize into valid Bech32 input or falsely confirm a transcription. All prior review findings are resolved; the remaining helper duplication is intentionally owned by #53. Exact-head Python-package run 637 succeeded.

No code blocker found; ready for human integration review after #12.

@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 review at 4f01561: no findings. Public header/index and confirmation paths now reject Unicode lookalikes before case folding while retaining ASCII case-insensitivity.

@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 4f01561. Public identifiers, indices, derivation targets, CLI headers, and card confirmation now reject/non-match non-ASCII lookalikes before lowercasing, so Unicode characters such as Kelvin sign cannot alias valid Bech32 ASCII. Ordinary ASCII case-insensitivity and whitespace-tolerant confirmation are preserved. Exact-head Python-package CI is green and all review threads are resolved. #53 can centralize the duplicated ASCII helper without changing this behavior.

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 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-24T09:22:48.259657Z 32db210 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

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 4f01561708

ℹ️ 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 added this pull request to stack #192 October 24, 2026 06:16
Base automatically changed from codex/v1-core-state-validation to codex/63-private-core-descriptors October 24, 2026 06:21
Reject non-ASCII identifiers, indices, and raw CLI creation headers before lowercasing so Unicode lookalikes cannot normalize into valid Bech32 symbols.

Make whole-card confirmation fold ASCII case only. Non-ASCII lookalikes now stay visibly mismatched and enter the normal retry flow for shared, unshared, and derived cards instead of being accepted or reaching the ceremony callback as an apparent match.

Document the ASCII-only confirmation boundary in the API and security model.

Validation: 867 tests passed normally and under python -O; Ruff check and format passed; strict mypy passed; git diff --check passed.
@BenWestgate
BenWestgate force-pushed the codex/v1-ascii-normalization branch from 4f01561 to 6f3dac8 Compare October 24, 2026 06: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.

Comment thread src/codex32/_cli_input.py Outdated
Comment on lines +69 to +71
def _ascii_lower(value: str) -> str:
"""Lowercase ASCII letters without normalizing Unicode lookalikes."""
return "".join(character.lower() if character.isascii() else character for character in value)

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.

let's just reject non-ASCII input entirely. Do not accept Unicode anywhere to avoid the lookalikes.

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.

Addressed in 58ea30d: reject non-ASCII before CLI whitespace normalization, parsing, or card confirmation. Unicode whitespace cannot disappear silently. Focused tests: 67 passed.

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.

Why is this function still in here then? I'm suggesting the command fail closed if unicode is pasted/entered. We don't need to support or tolerate it even as a "mistake" at all. it's an uncorrectable mistake, we just quit so we don't have to deal with this stupid implausible finding. nobody will ever type uppercase Kelvin.

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.

Addressed in 32db210. Removed _ascii_lower and Unicode retry handling. Non-ASCII input now aborts before normalization; library confirmation raises an error. Net PR: +75/−8, including 27 added production lines. 356 affected tests pass normally and optimized; Ruff/mypy pass.

Reject non-ASCII input before whitespace splitting or lowercasing, including nonbreaking spaces. Preserve existing interactive read-back spacing and fail confirmation on Unicode rather than silently dropping it.

Validation: 72 focused tests normally and under optimized Python, Ruff, mypy and diff checks. refs #13
@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.

cNACKing the PR until someone explains why it needs to be 100 lines to fail when unicode is entered.

Copy link
Copy Markdown
Owner Author

@codex review

Reject non-ASCII text before whitespace removal or case folding.
End the command instead of retaining Unicode in transcription retry
state. Remove ASCII-only folding and its special retry handling.

The library confirmation boundary also rejects non-ASCII rather than
returning group feedback for it. Ordinary ASCII grouping and case
remain accepted.

Validation: 356 affected tests pass normally and with Python -O;
Ruff lint/format, mypy and diff checks pass.

refs #13
@BenWestgate BenWestgate changed the title bip93: Reject non-ASCII normalized input bip93: Reject non-ASCII before normalization Oct 24, 2026

@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 static review: ACK 32db210. The diff adds 27 production lines across distinct CLI and library input boundaries; the rest is regression coverage and documentation. Non-ASCII input is rejected before case conversion, whitespace removal, or confirmation. The earlier Unicode retry path is gone. No remaining code blocker found.

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

bip93 BIP93 encoding, checksum, parsing, and format rules. bug Something isn't working correction Correction engine and correction UX. 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