-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTPS upgrades proposal #1655
base: main
Are you sure you want to change the base?
HTTPS upgrades proposal #1655
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more nits. Otherwise, non-authoritiative LGTM
Thanks for all the help with editing this Yoav! @annevk I think this PR should be in a good place now if you have time to take a look. |
I'm not sure why the CI build is failing -- the bikeshed error |
It would help a lot if this was rebased as a single commit describing the changes it is making. (I attempted to rebase locally against main in order to address the CI issue but immediately ran into a merge conflict.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this. I've done an initial review that mainly focuses on editorial issues.
annevk: Friendly ping |
Pinging again -- let us know if there are any remaining concerns. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the delay here. I blame European summer.
So this still applies:
It would help a lot if this was rebased as a single commit describing the changes it is making. (I attempted to rebase locally against main in order to address the CI issue but immediately ran into a merge conflict.)
In particular it seems Build (CI) hasn't even run for this change, which is a problem.
68081a0
to
c5eefe7
Compare
Thank you for the review! Rebased into a single commit, but the Build still doesn't seem to be running. I get a "1 workflow awaiting approval" warning above it, so not sure if a maintainer needs to specifically allow it to run. |
c5eefe7
to
36258fd
Compare
Hey @meacer, thanks for the update. I left a bunch of inline comments including on some of the old threads. I think it would be good for you to resolve all the threads you consider resolved at this point and leave those open you still have questions on. Generally instead of writing "Done" hitting "Resolve conversation" is fine. That also helps the reviewer to know what to focus on. Also if you want any kind of live feedback I'd recommend https://whatwg.org/chat. |
@annevk Apologies for the comment noise. I'm not the original author of the PR so I don't have the "Resolve conversation" option. I asked Carlos to resolve most of them (thanks Carlos!). I'll need to think about the service worker parts before I respond on the remaining threads. Thank you again. |
54a3d49
to
74247e3
Compare
@annevk I believe my last commit addresses all your comments. Could you please take a look when you have a chance? Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mainly nits and still the fundamental question about why you're patching HTTP fetch rather than HTTP-network fetch.
Having a commit message somewhere explaining the rationale behind the changes would go a long way.
Thanks @annevk, that is indeed what I was looking for. If you don't mind, could you point me at the right text? I checked again but still cannot find it. |
It's subtle, but because only the scheme is changed the port remains unchanged. And when the scheme is "http" the port is either null or a non-80 integer (due to the URL parser). And when you go make a request and the scheme is "https" and the port is null, it uses 443. (This subtle behavior happens in multiple places though so I'm a bit hesitant to add notes all over, but maybe there's a way to make it work well.) |
The explainer touched on loop handling behavior:
I don't see this in the PR and this WPT implies that the query string should be part of the data used for detecting loops. Should this be part of the spec and not just the test? Also, I guess that the fragment should not be part of such a check, correct? |
The only thing I don't see is "redirect loop" and I also don't see that being tested. However, I don't think we should add that as we already have a limit on 20 redirects that should suffice. |
For context, Chrome seems to have explicit loop detection: https://chromium.googlesource.com/chromium/src/+/refs/heads/main/chrome/browser/ssl/https_upgrades_interceptor.cc#519 The WPT is upgrading with What should happen on pages which redirect after a timeout like (www.bom.gov.au) which gets upgraded and then redirected to (http://www.bom.gov.au/akamai/https-redirect.html) which redirects using |
I believe there is a disconnect about the redirect loops between what @annevk and @simon-friedberger understood. The issue isn't reaching the maximum of allowed redirects, but whether a browser should look at previous URLs in the redirect chains to stop upgrading. E.g., for a page that supports HTTPS but redirects back to HTTP. Specifically, how "far" does the browser look back? All 20? Which information does the browser use to consider something a loop? Just the domain? The site? With URL parameters? If all browsers have explicit "loop breakout logic", we should specify it. |
I thought I understood, but now various kinds of redirects are getting conflated and it's getting confusing. I'm not sure this PR is the best place to have that discussion. I don't think we should have loop detection for HTTP or (specified) internal redirects. Website-driven navigations that look like redirects are not covered here. If they should be that should also be discussed in a new issue. |
Isn't there a problem specific to HTTP upgrades, though? If a website has a redirect loop, sure, the website needs to fix it. But if there is a redirect loop in the browser because it is upgrading HTTP to HTTPS it needs to be fixed in the browser. Anyway, just let me know if I should file a separate issue, please! |
Should this behavior be changed and custom ports be exempt from upgrades? Configurations which use the same port for HTTP and HTTPS seem rare (I don't have any data). In some cases this does cause bugs like the one linked above: aio-libs/aiohttp#8065 & python/cpython#109765 |
@meacer Are you still working on this? Have Chrome's plans for this changed somehow? |
Apologies for my late reply. Chrome's plans for HTTPS Upgrades haven't changed. In fact HTTPS Upgrades are now enabled by default in Chrome, starting in Chrome 115. Therefore, this spec change is still a priority for us. Regarding redirect loop detection: I don't think it's possible to break out of loops between https upgrades and http fallbacks without any sort of detection logic. The https://www.bom.gov.au/ example above is a good one where this is needed. Given that most browsers will need this, I agree it makes sense to add it to the spec. |
It looks like there is a logic error in the fallback handling. This is inserted before the HSTS and HTTPS RR handling so a request will have its "is HTTPS upgrade" flag set and a downgrade will be attempted even if HSTS or HTTPS RR would have enforced HTTPS anyway. |
I would point out that it's actually quite complex to setup a server that supports this in most software (see for example: https://serverfault.com/questions/47876/handling-http-and-https-requests-using-a-single-port-with-nginx/). So, I'd agree this seems unlikely. |
Hello, I made a few changes to this PR:
(3) also makes the flow more in-line with the HTTPS Upgrades implementation in Chrome. Chrome does HTTPS upgrading before HSTS, but first checks if the URL would be upgraded by HSTS. If yes, it doesn't continue with the upgrade and lets HSTS handle the navigation. This latest change should handle all of the concerns raised in the comment thread before. Please let me know if the latest diff looks good, thanks. |
96b4288
to
043386a
Compare
@meacer If I am reading this correctly you are saying "don't upgrade custom ports, but we're not specifying it". Why not specify it? ISTM that there is too much going on under |
043386a
to
377824d
Compare
That's fair. I think all implementations are going to have this exception, so I explicitly specify it now. |
Afaict |
I already filed an issue for redirect behavior a while ago: #1738 Only an example mentions it and it is fairly trivial: There are plenty of common but more complicated cases like Chrome has implemented a quite thorough redirect URL list to detect arbitrarily complicated loops. Some redirect detection should be standardized. The fact that we have WPTs for it is a good indicator that we want to align on the same behavior here. |
(See WHATWG Working Mode: Changes for more details.)
Preview | Diff