Skip to content

Restrict Discover and JCB issuer prefixes - #569

Open
Aschenbath wants to merge 1 commit into
python-validators:masterfrom
Aschenbath:fix/card-issuer-prefixes-20261115
Open

Aschenbath wants to merge 1 commit into
python-validators:masterfrom
Aschenbath:fix/card-issuer-prefixes-20261115

Conversation

@Aschenbath

Copy link
Copy Markdown

Luhn-valid numbers such as 6020000000000003 and 3500000000000009 currently pass as Discover and JCB cards even though their issuer prefixes are outside those networks.

Restrict JCB to 3528–3589, and Discover to 6011, 644–649, 65, and the 622126–622925 co-branded range. Keep the existing 16-digit and checksum requirements. Add synthetic card-number tests around both ends of each range and controls for invalid checksums.

Fixes #566.

Validation on Windows:

  • New regression selection against original production code: 12 failed, 15 passed.
  • Complete pytest/doctest suite: 1,601 passed on each of Python 3.11.17, 3.12.12, 3.13.17, and 3.14.9.
  • Project tox environments for lint, type checking, formatting, and Bandit all pass; tox also builds and installs the source distribution.
  • The Python 3.13 environment initially hit an invalid interpreter shim in the local PATH. Rerunning that environment with the installed interpreter first in a process-local PATH passed; repository configuration was unchanged.

Implementation and local validation were prepared with Codex.

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.

discover() and jcb() accept card numbers from outside their issuer's IIN ranges

1 participant