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

consider allowing static routing only for "foreign fetch" for anonymous requests #1024

Closed
wanderview opened this issue Dec 12, 2016 · 3 comments

Comments

@wanderview
Copy link
Member

One of the lingering concerns with foreign fetch service workers is the potential for tracking. For example, I believe web font loads are requested without cookie credentials. This is to prevent the font serving origin from tracking a particular user across sites. Foreign fetch, however, would allow the font serving origin to run script and store any manner of data in IDB, etc. In many ways it makes the tracking issue worse.

It would be nice if we could just disable foreign fetch for requests that do not allow cookie credentials. This would break one of our main use cases, though; web fonts.

As a compromise, I was wondering if could restrict the ForeignFetchEvent to only credentialed requests, but still allow non-credentialed requests to be handled by a static route configured by the foreign fetch service worker.

You may be wondering what I mean by "static route". This is something that has been discussed, but doesn't exist yet. See:

#920 (comment)

The idea would be to allow the service worker to programmatically setup a set of static resources to respond to foreign origin requests. This lets the foreign fetch SW handle the most common use cases like the providing offline access to web fonts. At the same time, by not firing a javascript event we can avoid the risk the SW will perform additional work to track the user.

This would also get triggered for browser features like disabling 3rd party iframe cookies, etc. Since the requests are sent without credentials the same restrictions on the foreign fetch SW would apply.

This would allow us to achieve the main use cases we were targeting while also avoiding new privacy leaks. It would also continue to work in a progressive way just like foreign fetch does today. On browsers without this feature the requests would just go to the network/http-cache as they do today.

@jakearchibald @mkruisselbrink Thoughts?

@wanderview wanderview added this to the Version 2 milestone Dec 12, 2016
@jakearchibald
Copy link
Contributor

jakearchibald commented Dec 13, 2016

STATIC ROUTES MOTHERFUNKERZ!!

I'm similarly concerned about the privacy aspect here. Another way around it would be to make foreign fetch opt-in by the site (via meta tags or something in the site's service worker), but I guess that also raises the bar to entry.

@wanderview
Copy link
Member Author

I think we've mainly be considering static routes as an optimization in the past. The fact it avoids js, however, makes it also a nice way to restrict arbitrary code execution in dangerous situations. This could be more of a driver to implement it (for me anyway).

For example, another possible use here would be a CSP directive indicating static routing is allowed, but service worker js should never be executed. This would allow a site to utilize some of our main use cases while locking down the risk of losing control of their site via some XSS service worker exploit.

@jakearchibald
Copy link
Contributor

Closing, since we're removing foreign fetch.

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

No branches or pull requests

2 participants