w3c / ServiceWorker

Service Workers
https://w3c.github.io/ServiceWorker/
Other
3.63k stars 313 forks source link

Path-based scope restrictions? #253

Closed slightlyoff closed 9 years ago

slightlyoff commented 10 years ago

Pace the discussion in #224, there is renewed interest in figuring out some way to make it less onerous for sites that host many user's content on a single origin to avoid URL-space bun-fights and malicious "takeover" using SWs.

At some level this is theater. Many other resources can be poisoned. We don't have any concept of "sub-origin" today and the SW design is the wrong place to construct such a thing.

So, noting the above, is it still meaningful to restrict scopes? E.g., the restriction might be that a visit to https://example.com/app/index.html would only allow registration for https://example.com/app/* but not https://example.com/* or https://example.com/otherstuff/*.

This restriction would be in addition to the other restrictions currently placed on SW registrations, namely: SSL-only, same-origin-hosted SW scripts, and 24-hour max caching before update pings sent to the server. It would likewise be additive to proposed mitigations against compromise (e.g., #224).

From the spec side, this has some issues:

/cc @phuu @jakearchibald @devd @sicking @shinypb @mikewest @annevk @abarth

annevk commented 10 years ago

/app/ could just embed an