-
Notifications
You must be signed in to change notification settings - Fork 35
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
What is the meaning of 'path' in accessors? #10
Comments
#4 is somewhat related. When I was sketching a similar design (w3c/ServiceWorker#707 (comment)) I couldn't settle on "match" or "get". "get" doesn't map well. WIth the singular get/match, "name" is required, it doesn't make sense otherwise. With getAll/matchAll the name is optional. It feels like the APIs should reflect that. Eg: navigator.cookies.match(name, { path });
navigator.cookies.matchAll({ name, path }); In the singular match, I'm not sure what the default path should be, maybe it should be required too. Additionally I can't decide if "path" should be treating the path as a key, or a scope. Eg: navigator.cookies.matchAll({
path: someRequest.url
}); Should the above return me all cookies with their path set to |
I think trying to fit this into a map-like shape is confusing things. Maybe it should be simpler?
I think the defaults and path stuff are too confusing in the
|
Hmm, I guess it should only be "cookies for this origin and parent origins". Exposing cookies targeted to other subdomains would be bad. |
Exposing paths and/or domains is new information not currently visible on Allowing the path to be specified seems OK, but I think requiring it is
|
(Also, specifying a read path just means you get back all cookies in-scope
|
Right, but should we carry on that tradition? I can work out the path of cookies by loading an iframe and brute forcing the url & seeing how
If you can specify the path, you make the above hack even easier.
I don't disagree with that behaviour, but it makes this very un-map-like. The meaning of "path" in get/set becomes quite different. |
My only intent when including a path argument was to allow a ServiceWorker to see script-visible cookies which would be in-scope for a given Fetch interception. |
Yep, it's a good use-case |
No it wouldn't. TIL multiple cookies of the same name are sent in this case. |
I think we have to, otherwise this API is useless. The original point of this API was to allow people to manage cross-site logins in their service workers. |
I've attempted to address this issue in the explainer (where path is called 'url' instead). Please take a look there and let me know what you think. In particular, I think the IFRAME-based brute-forcing is preventable by a server rigorously sending X-FRAME-OPTIONS: DENY provided the user isn't tricked into allowing a pop-up. What do you think? |
Fixed explainer link |
Polyfill for document contexts and explainer are synced now on this issue. Re-open if you think the path restrictions are problematic (and explain why, please!) |
has
/get
/getAll
take a path but don't do anything with it at the moment.The text was updated successfully, but these errors were encountered: