Closed Bug 2089373 Opened 13 days ago Closed 4 days ago

[wpt-sync] Sync PR 64412 - Revert "Prevent net/ from requesting invalid hostnames."

Categories

(Core :: DOM: Core & HTML, task, P4)

task

Tracking

()

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 64412 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/64412
Details from upstream follow.

luci-bisection@appspot.gserviceaccount.com <luci-bisection@appspot.gserviceaccount.com> wrote:

Revert "Prevent net/ from requesting invalid hostnames."

This reverts commit 370a8766e850dec28a81f5f0aacc13f1c86eae98.

Reason for revert:
LUCI Bisection has identified this change as the cause of a test failure. See the analysis: https://ci.chromium.org/ui/p/chromium/bisection/test-analysis/b/5706821961515008

Sample build with failed test: https://ci.chromium.org/b/8666480168227937233
Affected test(s):
://:chrome_wpt_tests!webtest::external/wpt/webdriver/tests/bidi/browsing_context/navigate#invalid.py

If this is a false positive, please report it at http://b.corp.google.com/createIssue?component=1199205&description=Analysis%3A+https%3A%2F%2Fci.chromium.org%2Fui%2Fp%2Fchromium%2Fbisection%2Ftest-analysis%2Fb%2F5706821961515008&format=PLAIN&priority=P3&title=Wrongly+blamed+https%3A%2F%2Fchromium-review.googlesource.com%2Fc%2Fchromium%2Fsrc%2F%2B%2F8680296&type=BUG

Original change's description:

Prevent net/ from requesting invalid hostnames.

The URL spec allows invalid hostnames to appear in URLs. When a webpage
requests such a URL, they're passed to net/. net/ will typically fail
such requests as the DNS layer, but if the requests end up not going
over DNS (e.g., in the case of proxies), we can end up actually trying
to send an over-the-wire request.

HSTS considers, e.g., http://a!b.c.com not to be a child of
http://c.com, but the cookie code does, which is problematic. While
sites should be using secure cookies, and not relying on HSTS to protect
cookies (which has its own lifetimes, max database size, and expiration
times), sites could even then use this to write cookies. So the current
logic is not very safe.

This CL fixes the issue by checking for hostname validity in
URLRequestHttpJob, and failing requests with ERR_INVALID_URL if the host
is not valid. This does mean that some domain names that once may have
worked in niche conditions (like proxies that do weird things) will now
fail, so this change is guarded by an enabled-by-default base::Feature.

It looks to me like the cookie spec says domain matching should fail on
these domains, so we should additionally change that, but rejecting
invalid HTTP URLs, instead of sending them to proxies that might not
know how to deal with URLs with invalid hostnames, is also a good idea,
and is a much simpler fix.

This CL also updates a couple of tests that now have failing navigations
as a result of this change.

Fixed: 579450551
Change-Id: I155448b3522625df7b869e225b260429fcb938a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8680296
Reviewed-by: Tom Sepez \<tsepez@chromium.org>
Reviewed-by: Adam Rice \<ricea@chromium.org>
Commit-Queue: mmenke \<mmenke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1731887}

No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: If9f6bbff2180dfb04d5568253996d3c1ad344637
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8692792
Commit-Queue: Syed AbuTalib \<lowkey@google.com>
Owners-Override: Syed AbuTalib \<lowkey@google.com>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com \<rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Syed AbuTalib \<lowkey@google.com>
Cr-Commit-Position: refs/heads/main@{#1732059}

Whiteboard: [wptsync downstream] → [wptsync downstream error]
Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core
Whiteboard: [wptsync downstream error] → [wptsync downstream]

CI Results

Ran 0 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 1 tests and 3 subtests

Status Summary

Firefox

OK : 1
PASS: 3

Chrome

OK : 1
PASS: 3

Safari

OK : 1
PASS: 3

Links

GitHub PR Head
GitHub PR Base

Pushed by wptsync@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/51ab0f7223bd https://hg.mozilla.org/integration/autoland/rev/08d6a7c59377 [wpt PR 64412] - Revert "Prevent net/ from requesting invalid hostnames.", a=testonly
Status: NEW → RESOLVED
Closed: 4 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
You need to log in before you can comment on or make changes to this bug.