Skip to content

Update URL tests to reject hostnames that end in numbers but are not IPv4 IPs#29666

Merged
domenic merged 9 commits intoweb-platform-tests:masterfrom
MattMenke2:master
Jul 26, 2021
Merged

Update URL tests to reject hostnames that end in numbers but are not IPv4 IPs#29666
domenic merged 9 commits intoweb-platform-tests:masterfrom
MattMenke2:master

Conversation

@MattMenke2
Copy link
Member

This pull request corresponds to the proposed URL spec changes in whatwg/url#619

It also adds a pair of tests for cases that don't seem to be covered by existing tests (A normal IPv4 IP, and a normal IPv4 IP ending in an extra dot)

I moved some pre-existing tests around that were affected by this change, but am also happy to just leave them where they are.

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After implementing the proposed spec update in jsdom/whatwg-url, things mostly pass but there's a couple extra slashes.

MattMenke2 and others added 2 commits July 14, 2021 18:22
Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me (though @domenic probably wants to run them through whatwg-url again), but having read the change proposal I was thinking we might want to cover these scenarios as well:

  • Various domains ending in ".09" and ".09." (always failure as far as I can tell)
  • Domains such as "test.0." and generally more dot-at-the-end variants

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passes in modified whatwg-url so LGTM. I'll be happy to re-run the tests if you add more cases as well.

@MattMenke2
Copy link
Member Author

This looks good to me (though @domenic probably wants to run them through whatwg-url again), but having read the change proposal I was thinking we might want to cover these scenarios as well:

  • Various domains ending in ".09" and ".09." (always failure as far as I can tell)
  • Domains such as "test.0." and generally more dot-at-the-end variants

I've beefed up tests a bit. Let me know what you think.

I've run url-constructor.any.html against Chromium hacked up to (hopefully) obey the new rules, and all the new/modified cases pass - I did that before, too, just didn't run the origin tests. This time I've run the origin tests, too, and they also look fine.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! @domenic will you confirm and merge?

@domenic domenic merged commit a85b7d6 into web-platform-tests:master Jul 26, 2021
annevk added a commit to whatwg/url that referenced this pull request Aug 5, 2021
If the last domain label of a URL's domain is numeric, it's parsed as IPv4, and if that fails, it's rejected. E.g., "foo.0", "bar.0.09", "a.1.2.0x.", "1.2.3.4.5" were all previously considered valid non-IPv4 domains, but are now all rejected.

Tests: web-platform-tests/wpt#29666.

Fixes #560.

Co-authored-by: Domenic Denicola <[email protected]>
Co-authored-by: Timothy Gu <[email protected]>
Co-authored-by: Anne van Kesteren <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants