Repository navigation
fix(dk/cvr): reject numbers that start with 0 - #171
Open
kallehauge wants to merge 3 commits into
Open
kallehauge wants to merge 3 commits into
kallehauge wants to merge 3 commits into
Conversation
No CVR number starts with 0, and python-stdnum's dk/cvr refuses them with InvalidFormat. Without the check, 00000000 passes as a valid CVR because its modulus 11 sum is 0, so a common placeholder value is accepted as a real company number.
Novo Nordisk A/S (24256790), active in the Danish CVR register, with and without the DK prefix.
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.
Problem
dk/cvraccepts00000000as a valid CVR number:Its modulus 11 sum is 0, so the check digit matches.
00000000is a common placeholder in VAT-number fields, so it ends up treated as a real company number.Fix
No CVR number starts with
0. python-stdnum'sdk/cvrrefuses those withInvalidFormat(stdnum/dk/cvr.py#L56):This PR adds the same check.
00000000InvalidFormatDK00000000InvalidFormat01000004(passes modulus 11)InvalidFormat24256790(Novo Nordisk A/S)13585628Tested
src/dk/cvr.spec.ts: 3 new cases that fail before the change and pass after it, plus 2 showing a real company's CVR still passes (Novo Nordisk A/S, valid in the EU VIES service and active in the Danish CVR register).TZ=UTC npx jest --runInBandpasses, 200 suites / 1640 tests.npm run lintpasses.