Skip to content

Reject an underscore in the last domain label - #485

Open
SashaMIT wants to merge 1 commit into
python-validators:masterfrom
SashaMIT:tld-underscore
Open

SashaMIT wants to merge 1 commit into
python-validators:masterfrom
SashaMIT:tld-underscore

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Oct 1, 2026 •

Copy link
Copy Markdown

domain("foo.ba_r") returned True, and domain("example.co_uk") did too. hostname("foo.ba_r") and email("a@foo.ba_r") did too.

An underscore is allowed in a service label when rfc_2782 is set. example_.com and _sip._tcp.example.com still need that flag, and they still pass with it. The last label allowed _ either way. example.com, xn----gtbspbbmkef.xn--p1ai, and a.co still pass.

Fixes #484.

Test plan

  • pytest tests/test_domain.py tests/test_hostname.py tests/test_email.py (119 passed)

The last label allowed "_" with or without rfc_2782, so foo.ba_r validated.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An underscore in the last domain label is accepted

1 participant