servo / servo/rust-url

Properly log validation errors related to legacy IPv4 notations

Open
#498 15 comments 1 reaction 1 assignee View on GitHub

@nox is already working on this.

Since Jul 18, 2019.

breaking-change
Dominant language
Rust
Stars
1.6k
Forks
406
PR merge metrics
No merged PRs in 30d

Description

The current rev of the URL Standard specifies that the various legacy notations accepted by inet_aton for IPv4 addresses are validation errors, but rust-url silently accepts them (they're not even diagnosed via the syntax violation callback). I would like to have an option to reject these.

Examples of undesirable constructs:

# all are treated as equivalent to http://127.0.0.1/
http://127.0.1/
http://127.1/
http://0177.0.1/
http://0177.0.0.1/
http://0177.1/
http://0x7f.0.1/
http://0x7f.0.0.1/
http://0x7f.1/
http://2130706433/
http://0x7f000001/
http://017700000001/

# equivalent to http://127.0.0.8/ , not http://127.0.0.10/
http://0127.0.0.010/

See https://url.spec.whatwg.org/#concept-ipv4-parser (pay close attention to where it, and its subroutine https://url.spec.whatwg.org/#ipv4-number-parser , set the "validationErrorFlag") for gory details.

Previous discussion in #116.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.