fix(isTaxID): reduce pl-PL and lv-LV check digit modulo 10#2827
Open
gaoflow wants to merge 1 commit into
Open
Conversation
plPlCheck (PESEL) and lvLvCheck both compare a raw modulus result against a single digit without reducing it back into 0-9, so on the boundary residue the comparison demands a check digit of 10 and no digit can satisfy it. Every PESEL and every pre-2017 Latvian personal code whose check digit is 0 is rejected. Same reduction validatorjs#1529 applied to elGrCheck.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2827 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 114 114
Lines 2600 2600
Branches 659 659
=========================================
Hits 2600 2600 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
plPlCheck(PESEL) andlvLvCheckcompare a raw modulus result against a single digit without reducing it back into 0–9, so on the boundary residue the predicate demands a check digit of10and none of the ten digits can satisfy it. Every valid PESEL and every valid pre-2017 Latvian personal code whose check digit is0is rejected — about 10% and 9% of those two ID spaces.The fix is the same
% 10reduction #1529 applied toelGrCheck. I checked the rest of the file for the same boundary: bg-BG, dk-DK, es-AR, et-EE, pt-BR, pt-PT, ro-RO, uk-UA and the ISO 7064 helper already map the out-of-range residue back to a digit, and hu-HU, nl-NL and sl-SI reject it because those numbers genuinely are not issued — these two were the only ones missing it. The new fixtures cover each century branch of both functions and fail without thesrc/change;npm testpasses with it.