python-hyper / python-hyper/rfc3986

uri_reference.is_valid() accepts invalid hostnames and out-of-range ports

Open
#138 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
189
Forks
38
Avg merge
13h 36m
Merged PRs (30d)
1

Description

The validator returns True for inputs that violate URI rules.

Examples:

In [15]:  uri_reference('google.com/path').is_valid()
Out[15]: True
In [27]:  uri_reference('http://example.com:99999/').is_valid()
Out[27]: True

Expected behavior:

The validator should reject missing schemes when a hostname is present
and should reject port values greater than 65535.

Actual behavior:

is_valid() returns True for both invalid inputs.

Steps to reproduce:

  1. Run the two example expressions in a Python REPL.
  2. Observe that both return True.

Environment:

Library version:
Python version: Python 3.10.14
OS: Windows

Fix? :

  • Add port range validation and treat bare hostnames with paths as invalid
  • unless explicitly allowed by the spec.

Contributor guide

No contributing guide indexed for this repository

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 by reproducing both examples in a Python REPL and trace how uri_reference(...).is_valid() validates hostnames and ports. Done means bare hostnames with paths and ports above 65535 are rejected, with tests covering both reported inputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.