Skip to content

Hostname format check does not allow single labels #1162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
swaeberle opened this issue Sep 12, 2023 · 2 comments · Fixed by #1164
Closed

Hostname format check does not allow single labels #1162

swaeberle opened this issue Sep 12, 2023 · 2 comments · Fixed by #1164
Labels
Bug Something doesn't work the way it should.

Comments

@swaeberle
Copy link
Contributor

The hostname format checker currently does not allow hostnames without a domain part, hence a single label like localhost is rejected as invalid hostname.
This is caused by class FQDN from fqdn assuming a minimum of two labels.

AFAIK, single labels are not excluded by the RFC 1123 and class FQDN can be forced to accept also single labels in its constructor (min_labels=1).

If rejecting single labels is not the intended behavior, I will send a PR.

@Julian
Copy link
Member

Julian commented Sep 12, 2023

Thanks! The first step here (assuming you're correct, which I have to double check the RFC, but willing to initially take your word for it :) is to add a test upstream to the official test suite (which I also maintain).

That's here -- could you perhaps have a look there at the hostname (and IDN hostname) format tests, see if you follow how to add one, and then once it's merged there we can pull and add the suggested fix to how we call fqdn.

@Julian Julian added Bug Something doesn't work the way it should. Needs Test Upstream Issues that need to have a test added to https://github.com/json-schema-org/JSON-Schema-Test-Suite labels Sep 12, 2023
@swaeberle
Copy link
Contributor Author

@Julian Julian removed the Needs Test Upstream Issues that need to have a test added to https://github.com/json-schema-org/JSON-Schema-Test-Suite label Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something doesn't work the way it should.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants