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

6265bis doesn't have an opinion on localhost cookies #1289

Open
sbingler opened this issue Oct 14, 2020 · 4 comments
Open

6265bis doesn't have an opinion on localhost cookies #1289

sbingler opened this issue Oct 14, 2020 · 4 comments

Comments

@sbingler
Copy link
Collaborator

Sparked from: web-platform-tests/wpt#26123

6265bis-06 doesn't seem to have any instructions on how to handle cookies set on/by localhost. More specifically for this issue: how the Domain attribute should be handled.

Chrome disallows this action, which makes sense to me, but this seems ripe for implementation specific behavior.

Should 6265bis take a stance here?

@DCtheTall
Copy link
Contributor

CC @mikewest

@davidben
Copy link
Contributor

Does Chrome disallow it by way of special-casing localhost, or is it because localhost is treated as an eTLD and eTLDs can't set domain attributes? I assumed it was the latter. The domain attribute seems to work just fine on http://foo1.bar.localhost and http://foo2.bar.localhost in testing.

@DCtheTall
Copy link
Contributor

DCtheTall commented Oct 15, 2020

An important clarification is that including Domain=localhost in the Set-Cookie header in Chrome on localhost works, but the leading-dot Domain=.localhost would be disallowed in Chrome unless the request URL is a subdomain of localhost.

@mnot mnot added the 6265bis label Dec 6, 2020
@sbingler
Copy link
Collaborator Author

sbingler commented Feb 5, 2021

I poked around a bit and it appears the reason is because Domain=localhost contains only a single subcomponent ("localhost"), which will always return an empty string when Chrome attempts to get the registered domain as per this function

Whether this decision was made with any thought toward "localhost" I can't say, but it does explain why a sub-domain under localhost can set a Domain cookie.

@chlily1 chlily1 added the defer label Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants