| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
The SSN regex used the character classes [1,2] and 2[A,B], which also
match a literal comma. fr_ssn(', 84 12 76 451 089') was therefore
accepted as valid. Drop the commas ([12] and [AB]); valid SSNs are
unaffected.
ind_pan used re.match(r"[A-Z]{5}\d{4}[A-Z]{1}", ...) with no trailing $,
so any string starting with a valid PAN was accepted -- e.g.
ind_pan('ABCDE9999KEXTRA') returned a match. Anchor the pattern with
^...$, matching the ind_aadhar style just above it.
| Back | FazBrowse Home | New Git URL |
Two small regex-correctness fixes in the i18n validators; each currently lets invalid input through. Both are covered by new regression tests that fail on master and pass with this change. ruff is clean and the full suite passes.
ind_pan — trailing characters accepted
ind_pan used re.match(r"[A-Z]{5}\d{4}[A-Z]{1}", value) with no trailing $. re.match only anchors the start, so any string that begins with a valid PAN was accepted:
Anchored the pattern with ^…$, matching the ind_aadhar pattern just above it.
fr_ssn — comma accepted as gender / Corsica suffix
The SSN regex used the character classes [1,2] and 2[A,B], which also match a literal comma:
Dropped the commas ([12] and [AB]). Valid SSNs are unaffected.