Skip to content

Require complete BTC and ETH address matches - #509

Open
xiehuanyi wants to merge 1 commit into
python-validators:masterfrom
xiehuanyi:fix/complete-crypto-address-matches-20261012
Open

xiehuanyi wants to merge 1 commit into
python-validators:masterfrom
xiehuanyi:fix/complete-crypto-address-matches-20261012

Conversation

@xiehuanyi

Copy link
Copy Markdown
Contributor

BTC SegWit and lowercase/uppercase ETH address validators accept a valid address followed by a final newline because $ can match before it. For example, btc_address("bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq" + "\n") currently returns True.

Use full matches for the two complete-address patterns. Existing alphabets, legacy BTC and mixed-case ETH checksums, and provider behavior are preserved; SegWit remains the documented approximate regex check. This overlaps the ETH regex line in #448, whose broader provider/checksum rewrite still uses prefix matches and does not resolve this newline acceptance.

Validation: the new 20-case suite has four failures on unchanged master; all 100 crypto tests and all 1,191 tests/doctests pass after the fix. Official tox lint, type, format, sast and py314 checks pass on Python 3.14.8. Other supported interpreter versions were not run locally.

Prepared with OpenAI Codex assistance and independently reviewed before submission.

Copilot AI balanced review requested due to automatic review settings October 12, 2026 10:56

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants