Skip to content

test: hostname format check fails on empty string #758

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

Merged

Conversation

sirosen
Copy link
Contributor

@sirosen sirosen commented Jan 30, 2025

This is a follow-up PR for #677 (resolves #677).

I've picked up the original work and preserved the original commit (singular) with a merge-back of main to resolve conflicts.

Based on the thread contents there and my own reading of RFC 1123, empty strings should not be allowed.
Using my own judgement -- which I believe matches @Julian's comments in the #677 thread -- I believe that this should apply to the earlier drafts as well, even though their definitions of the hostname formats refer to RFC 1034.
1034 does not appear to be an appropriate source for validation behaviors, as it defines a broader category of values than hostnames.1

Footnotes

  1. I actually think this is badly wrong enough that the correct course of action is to correct past drafts to reference RFC 1123, but I don't know what the process for doing so would be.

jvtm and others added 2 commits July 13, 2023 12:11
Assert that hostname format validation fails gracefully on empty strings.

This is especially for Python `jsonschema` library that raises an unexpected
ValueError exception on `hostname` check (python-jsonschema/jsonschema#1121).

Adds similar test for:
 * draft3: host-name
 * draft4: hostname
 * draft6: hosntame
 * draft7: hostname, idn-hostname
 * draft2019-09: hostname, idn-hostname
 * draft2020-12: hostname, idn-hostname
 * draft-next: hostname, idn-hostname
@Julian
Copy link
Member

Julian commented Jan 30, 2025

Nice, thanks for finishing this off, appreciated!

@Julian Julian merged commit dcdae5c into json-schema-org:main Jan 30, 2025
3 checks passed
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.

3 participants