json-schema-org / json-schema-org/JSON-Schema-Test-Suite

Add test to ensure dotted-decimal IPv4 addresses are rejected by format: hostname

Open
#838 9 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
750
Forks
307
Avg merge
3d 17h
Merged PRs (30d)
24

Description

The current format-hostname test suite does not include a case ensuring that dotted-decimal IPv4 addresses (e.g., 192.168.0.1) are rejected.
Because hostname labels are allowed to:

  1. start with digits, and
  2. be entirely numeric,

a validator may incorrectly validate 192.168.0.1 as four numeric labels and accept it as a hostname.

However, RFC 1123 section2.1 mentioned in the spec states:
a valid host name can never have the dotted-decimal form #.#.#.#

Image

Therefore, dotted-decimal IPv4 addresses must not be considered valid hostnames.
Since we already provide a separate format: ipv4, allowing such values to pass hostname would blur the distinction between the two formats.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tests/draft2020-12/optional/format/hostname.json, the existing format-hostname test suite. Add a dotted-decimal IPv4 example such as 192.168.0.1 to the rejected cases, and confirm the suite clearly distinguishes hostname validation from the separate ipv4 format.

Written by the indexing model from the issue text.

Assessment

Domain
testing
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.