Skip to content
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

Check if final debounce URL's hostname has at least eTLD + 1 #23580

Open
ShivanKaul opened this issue Jun 21, 2022 · 3 comments
Open

Check if final debounce URL's hostname has at least eTLD + 1 #23580

ShivanKaul opened this issue Jun 21, 2022 · 3 comments
Assignees
Labels

Comments

@ShivanKaul
Copy link
Collaborator

ShivanKaul commented Jun 21, 2022

For AMP URLs (and there will probably be others), there are cases where the embedded target URL in the original URL that we want to debounce does not have a scheme, for e.g. https://theguadian.ampproject.org/c/s/www.newsarticleonguardian.com -- www.newsarticleonguardian.com is not a valid URL (and hence not parsed as one at least in Chromium and also by iOS it looks like) because it does not have a scheme. We create the right debounce URL by using a new property called prepend_scheme : http | https as described in #23121

The trouble is that if the original URL looks something like https://theguadian.ampproject.org/c/s/foo, and prepend_scheme is https, then we debounce to https://foo/, which is not actually a valid website, even though https://foo/ is technically a valid URL.

The proposed solution is (@fmarier):

  1. Once you have a valid URL, extract the hostname.
  2. Check that the hostname has at least an eTLD + 1 (e.g. example.com -> [example, com] ✅; http://foo/ -> [foo] ❌).
  3. Reject the URL if the hostname doesn't have at least an eTLD + 1.

We should do this for all debounce actions.

@ShivanKaul ShivanKaul self-assigned this Jun 21, 2022
@ShivanKaul
Copy link
Collaborator Author

@pilgrim-brave @pes10k

@pilgrim-brave
Copy link

Sure

@ShivanKaul ShivanKaul changed the title Check if final debounce URL's hostname has at least 2 non-empty parts Check if final debounce URL's hostname has at least eTLD + 1 Jun 22, 2022
@pes10k
Copy link
Contributor

pes10k commented Jun 29, 2022

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants