Skip to content

Spanish identifier validators accept non-ASCII letters after case conversion #575

Open

Description

@prathamchoksi

The numeric-body ASCII checks added in #519 do not reject non-ASCII letters in prefix/control positions before uppercase normalization.

On current master:

from validators import es_nif, es_nie, es_cif, es_doi
es_nif("00000038\u017f")  # True; long s becomes S
es_nif("00000038\u00df")  # True; sharp s expands to SS
es_nie("X0000038\u00df")  # True
es_cif("\u017f0000000J")  # True

The DOI dispatcher accepts the same malformed identifiers. Expected: ValidationError for these values, while valid ASCII identifiers and their existing accepted case variants keep working. In the sharp-s case the input passes the original nine-character length check, then expands to ten characters, but validation ignores the extra letter.

Impact: invalid tax/identity identifiers pass validation even though their characters are outside the expected ASCII alphabet. I assess this as medium severity, not a maintainer-applied label. Eight regressions fail on unchanged master; a focused fix moves ASCII checking ahead of case conversion for the complete identifier. Codex assisted with investigation and tests.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions