Skip to content

Reject non-ASCII case equivalents in IBANs - #512

Open
JunaidAhamed-7777 wants to merge 1 commit into
python-validators:masterfrom
JunaidAhamed-7777:fix-iban-ascii-casefold
Open

JunaidAhamed-7777 wants to merge 1 commit into
python-validators:masterfrom
JunaidAhamed-7777:fix-iban-ascii-casefold

Conversation

@JunaidAhamed-7777

Copy link
Copy Markdown

The case-insensitive IBAN regex currently accepts Unicode case equivalents of ASCII letters. For example, iban("\u0131T60X0542811101000000123456") and iban("GB82WE\u017fT12345698765432") return True: dotless i and long s match [a-z] and become ASCII letters during the checksum calculation.

Add re.ASCII to the format check and regression tests covering the country code and account identifier. Existing lowercase and mixed-case ASCII IBAN support is preserved.

Validation on Python 3.14:

  • Both new regression cases failed before the fix.
  • All 8 IBAN tests pass after the fix.
  • The full local test run passed 1,097 tests; 18 Ethereum-address tests failed because the optional Ethereum hashing dependency is not installed. CI includes that extra.
  • git diff --check passed. Ruff and Pyright are left to CI.

AI-assisted using GPT-6; human review follows draft submission.

@JunaidAhamed-7777
JunaidAhamed-7777 marked this pull request as ready for review October 13, 2026 17:17

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