diff --git a/explainers/subresource-loading-opaque-origin-iframes.md b/explainers/subresource-loading-opaque-origin-iframes.md index 64fec3ee..aed06fd3 100644 --- a/explainers/subresource-loading-opaque-origin-iframes.md +++ b/explainers/subresource-loading-opaque-origin-iframes.md @@ -1,6 +1,6 @@ # Subresource loading with Web Bundles: Support opaque origin iframes -Last updated: Apr 2021 +Last updated: May 2021 This is an extension to [Subresource loading with Web Bundles]. This extension allows a bundle to include `urn:uuid:` URL resources, which will be used to @@ -65,36 +65,50 @@ Note: also used for `urn:uuid:` resources. For example, `scopes=urn:` allows all `urn:` resources. -### Content Security Policy (CSP) +### Content Security Policy (CSP) for `urn:uuid` resources -To allow `urn:uuid` resources in CSP, the `urn:` scheme must be explicitly -specified. "`*`" source expression does not match `urn:uuid` resources according -to the CSP's -[matching rule](https://w3c.github.io/webappsec-csp/#match-url-to-source-expression). +Using the `urn:uuid` URLs in CSP's +[matching rule](https://w3c.github.io/webappsec-csp/#match-url-to-source-expression) +is almost useless from a security standpoint, because anyone can use arbitrary +`urn:uuid` URLs. +So the CSP restrictions must be evaluated against the source of the bundle +instead of to the `urn:uuid` URL. For example, given this CSP header, ``` -Content-Security-Policy: script-src https://example.com/script/ urn:; frame-src * +Content-Security-Policy: script-src https://cdn.example; frame-src https://cdn.example ``` -In the following, the first and third ` - - + ``` +Note: +- When loading `HTTPS` resources from web bundles, the CSP restrictions must be + evaluated against the resource URL, not against the bundle URL. +- Loading `urn:uuid` resources from web bundles served from HTTPS server is + allowed when "\*" is set in the CSP + [source expression](https://w3c.github.io/webappsec-csp/#source-expression). + This is different from the CSP behavior that `data:` and `blob:` schemes are + excluded from matching a policy of "\*". Loading `urn:uuid` resources from web + bundles is safer than using `data:` or `blob:` URL resources which are + directly under the control of the page, because a `urn:uuid` resource is a + reference to a component of something with a globally-accessible URL. So we + don't need to exclude `urn:uuid` resources in a web bundle from matching the + policy of "\*". +- See an issue [#651](https://github.com/WICG/webpackage/issues/651) for the + detailed motivation. + [subresource loading with web bundles]: https://github.com/WICG/webpackage/blob/main/explainers/subresource-loading.md