-
Notifications
You must be signed in to change notification settings - Fork 21
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
Can't clear site data while offline #40
Comments
I have talked to several people building service worker-based apps that were considering using And the solution is not actually difficult. For simplicity (of spec and implementation), we proposed to completely disable |
Can the rules that decide whether a response is opaque or not be re-used to control whether clear-site-data works? |
Being able to "log out" and securely wipe all traces of a web app should indeed be possible offline. There may be cases where individual web app authors may prefer to be online and not support it while offline (e.g. if they want to clear stuff server-side as well) but that's not a reason not to offer the ability in the web platform. Back to the offline scenario, I think it might make sense to expose the "Clear site data" feature through a JavaScript interface to the worker. E.g. That way we can keep the restriction on the HTTP header to be limited to online fetched resources. It avoids any possibility of poisoning or circumvention through caches or any other intervention, whilst still explicitly granting a Service Worker to pull the plug through a programmatic interface, which naturally works offline (and would as such, could also remove the Service Worker itself and make site no longer offline available). |
@ithinkihaveacat Opaque responses are probably not a good precedent. Those can still set cookies, so prohibiting them from deleting cookies (...and other datatypes coming along with clear site data...) does not seem like the right choice. And since we're talking about consistency between setting and deleting cookies, note that service workers can't add/modify the We discussed this with @mikewest today and came to the same conclusion as you do, @Krinkle . The JS API is actually already spec'd (https://www.w3.org/TR/clear-site-data/#dom-api). Header is a good tool for a server requesting this functionality, but when you already have JS running locally, there's no reason not to use that. |
And more to the topic of consistency with Instead of having to explain the intricacies of service workers in the |
I think once you integrate with Fetch to define when the header gets processed it'll automatically fall out that service workers are not (or are, depending on what you do) considered. That integration is necessary anyway, otherwise it's not defined from first principles when this header is processed. |
I agree with @msramek that providing an API hanging off of
We're currently threading @msramek: Are you interested in extracting the monkey patch in https://w3c.github.io/webappsec-clear-site-data/#fetch-integration out into a PR against Fetch for deeper discussion? (@annevk: Would you accept a patch against Fetch given that there's only one implementation?) |
Are other implementations interested in this? I'd assume so. In any event, adding a single step with a note seems fine. We can add a source comment to indicate the implementation status. |
I believe so, yes. Folks were positive at TPAC. But no one I know of is actively working on an implementation, so... In any event, if you're happy adding it to Fetch, I'd be thrilled to get it out of this document. :) |
I'm interpreting @annevk 's thumbs up as yes. OK then, I'll send a PR for Fetch. |
Storage buckets might address this concern, since you can delete a bucket and service workers can be put in a bucket. https://github.com/WICG/storage-buckets/blob/gh-pages/explainer.md#deleting-buckets |
Since
clear-site-data
is "only respected on responses fetched over network, and not those served by a service worker", it can't be made to work offline.This means that a "logout" action that involves the use of clear-site-data cannot complete until the user agent is online.
I don't see how this can be fixed, but it's unfortunate.
The text was updated successfully, but these errors were encountered: