-
Notifications
You must be signed in to change notification settings - Fork 315
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
Feature request: Provide a way to delay execution of a new service worker #1208
Comments
This is totally the correct place to make this feature suggestion. You're not the first to suggest features that make the SW somehow resistant to updates. The problem is, the same feature could be used by a malicious service worker to prevent removal. At the moment, we guarantee that if the worst happens, and someone gets an evil service worker installed on your origin, you can undo the damage at the next update check. If the bad guy managed to set a long max-age on the script, it'll be capped to 24hrs. |
Hi @jakearchibald, thanks for your response. I'm not requesting the ability to prevent a Service Worker update, only the ability to delay it slightly. If the old Service Worker calls That last part is already allowed by the spec, I think: "However, the user agent may impose a time limit to this lifetime extension." Basically, all I want to do in the |
Ahh, sorry for misunderstanding! |
Btw #822 relates to preventing updates. |
Also similar #761 |
Thanks, I hadn't seen those. The use case in #822 (comment) is basically the same as mine, namely, 1) a web app that handles potentially sensitive user data and doesn't send it to the server, or only does so after encryption, and 2) wants to verify that all updates to the web app are authenticated. Together, those things move the web app from "trust the server every time you open it" to trust-on-first-use. The only thing that differs is what happens when an update is not authenticated:
One issue to consider is, what happens if there is no open/visible client of the Service Worker? That can happen if a third party origin loads the web app in an iframe (and either hides it, or the web app responds with One option if we go with option 2 above, is to request permission for Web Notifications ahead of time. Then, we can always warn the user in the Similarly, with option 3 above, we could default to not updating if there is no open client. |
I think I've found a workaround to this issue: instead of calling (the nonexistent) I believe all Service Worker updates will be preceded relatively shortly by a functional event, be it a Another downside is that, AFAICT, you have to register for all known functional events, because if you don't and it fires, the Service Worker is updated but not started (https://w3c.github.io/ServiceWorker/#handle-functional-event-algorithm, step 4.2). That is of course impractical and bad for performance (since the SW is uselessly started and made to keep running with |
This would be solved by this proposal: #822 (comment) |
Hi all, I just wanted to say why I think some version of this proposal would have a very positive impact on the future of the web:
By providing this guarantee via the spec, you will enable a decades-long dream of web developers to come true -- for it to be possible to build web applications that are approximately as trustworthy as native apps, arguably more so, since web apps cannot run around on the user's hard drive to wreak havoc, but are instead trapped in the browser. And for the majority of web apps who don't need such high security, they will remain unaffected. Would love to see some version of this get accepted! 👍 |
[I also posted about this on the mailing list, but I didn't receive any replies and I feel that this is important. Sorry if it comes across as spam.]
It would be nice if it were possible to reliably make a request from the
updatefound
event. Currently, if the new Service Worker callsskipWaiting()
, the old Service Worker gets killed and its request canceled in both Chrome and Firefox, with no way to avoid it, becauseupdatefound
is not anExtendableEvent
.Why? I'm trying to use Service Workers to solve the quite old and fundamental problem that on the web, you can't make applications that don't trust the server (and e.g. use client-side encryption) because the server sends you the code every time you open it. Basically, with Service Workers, I'm serving the code from SW cache instead, and only updating it if it matches some public log (in my case GitHub), in effect achieving some form of Binary Transparency on the web.
But, of course, the SW can update at any time. So, to make it secure, we need to check the new SW against GitHub as well, in the
updatefound
event, and warn the user if it doesn't match. (Of course, we can't prevent the update, but we can at least try to convince the user to close the web app before it steals their private keys.)The text was updated successfully, but these errors were encountered: