Systematically enforce full-string matching for Indian PAN validation - #478
Open
mokoro10 wants to merge 1 commit into
Open
Systematically enforce full-string matching for Indian PAN validation#478mokoro10 wants to merge 1 commit into
mokoro10 wants to merge 1 commit into
Conversation
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 usesre.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 neighboringind_aadharvalidator 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).