urlsplit manufactures hostnames because it strips off tabs before validating them
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Bug report
Bug description:
import urllib.parse
# prints "abcxyz.test"
print(urllib.parse.urlsplit("http://abc\txyz.test/").netloc)
Current urlsplit is implemented according to this spec:
https://url.spec.whatwg.org/#concept-basic-url-parser
The spec does say in item 3 to strip tabs, but I believe there's a bug in the specification (perhaps they wanted to say leading/trailing whitespace) because the item 7 in host parsing says
If asciiDomain contains a forbidden domain code point, domain-invalid-code-point validation error, return failure.
, and tab is listed as a "forbidden domain code point". If tabs are stripped from the entire input before any other work is done, checking for tabs in host names wouldn't make much sense.
I created a bug in the specification project, so maybe they will provide some guidance later on.
https://github.com/whatwg/url/issues/829
CPython versions tested on:
3.10
Operating systems tested on:
Linux, Windows
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the urllib.parse.urlsplit entry point and run the reproducer from the issue to confirm how an embedded tab changes the netloc. Read the linked WHATWG URL issue 829 for guidance on the specification conflict; done means tabs in the hostname are not silently turned into a different hostname.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100