FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Systematically enforce full-string matching for Indian PAN validation by mokoro10 · Pull Request #478 · python-validators/validators · GitHub

Repository navigation

Systematically enforce full-string matching for Indian PAN validation - #478

Open
mokoro10 wants to merge 1 commit into
python-validators:masterfrom
mokoro10:fix/pan-validator-trailing-data-anchor
Open

mokoro10 wants to merge 1 commit into
python-validators:masterfrom
mokoro10:fix/pan-validator-trailing-data-anchor

Conversation

Copy link
Copy Markdown

Replace prefix-oriented regex matching in the Indian PAN validator with re.fullmatch, ensuring that otherwise valid PAN prefixes followed by arbitrary trailing data are rejected.

ind_pan() currently uses re.match(r"[A-Z]{5}\\d{4}[A-Z]{1}", value), which is not end-anchored. Any string that merely begins with a syntactically valid 10-character PAN is accepted, even with arbitrary trailing characters (e.g. "ABCDE9999Kextra", "ABCDE9999K "). The neighboring ind_aadhar validator in the same file is already end-anchored, so this looks like an unintentional asymmetry rather than deliberate prefix matching.

This is a small, low-risk change (one line) plus two additional regression cases added to the existing parametrized test in tests/i18n/test_ind.py. Full test file passes locally (12/12).

This branch has not been deployed

No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL