-
Notifications
You must be signed in to change notification settings - Fork 118
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
Add an explainer for subresource signed exchanges #542
Changes from 1 commit
ba63b10
3a44a08
32b9a33
02ab3eb
82bbcba
a67da35
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,164 @@ | ||||||||||
# Signed Exchange alternate link | ||||||||||
## Introduction | ||||||||||
We want to extend the usage of the existing [rel=alternate](https://html.spec.whatwg.org/multipage/links.html#rel-alternate) link header for signed exchange. Using this link header, the content publishers can declare that the resource is available in signed exchange format. This can be used both by the crawlers of aggregator sites (SNS, News site, search engine..) and by the UAs. The crawlers can cache and serve the signed exchange of the content in their own server. The UAs can provide the users with a way to save the page in signe exchange format. And also signed exchange alternate links can be used to recursively prefetch appropriate subresource signed exchanges while prefetching the main resource signed exchange. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you wrap lines at 80 columns? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I think SNS means "social networking service", from https://en.wikipedia.org/wiki/SNS, but I had to look it up. We should expand acronyms at least the first time we use them, but I think we can just avoid this one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
## Use Cases | ||||||||||
### Signed Exchange discovery of main resource | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
However, I'm not sure this use needs to be in an explainer at all. The "Otherwise" branch in https://html.spec.whatwg.org/multipage/links.html#rel-alternate already says that "The keyword creates a hyperlink referencing an alternate representation of the current document. The nature of the referenced document is given by the hreflang, and type attributes." There's nothing new in saying that a signed exchange can be an alternate representation of a document. So maybe delete this whole sub-section. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Deleted this whole sub-section. |
||||||||||
1. Content publishers can declare the URL of signed exchange format of the content using an alternate link HTTP header or using an alternate link HTML element. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think the paragraphs in this section are really an ordered list.
Suggested change
|
||||||||||
- Example of signed exchange alternate link HTTP header in the HTTP response headers of the main resource of the content (https://publisher.example/article.html): | ||||||||||
``` | ||||||||||
Link: <https://sxg.publisher.example/article.html.sxg>; | ||||||||||
rel="alternate"; | ||||||||||
type="application/signed-exchange;v=b3"; | ||||||||||
anchor="https://publisher.example/article.html" | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Omit an
Suggested change
|
||||||||||
``` | ||||||||||
- Example of signed exchange alternate link HTML element in the main resource of the content (https://publisher.example/article.html): | ||||||||||
``` | ||||||||||
<link href="https://sxg.publisher.example/article.html.sxg" | ||||||||||
rel="alternate" | ||||||||||
type="application/signed-exchange;v=b3" | ||||||||||
anchor="https://publisher.example/article.html"> | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also omit this one.
Suggested change
|
||||||||||
``` | ||||||||||
1. This signed exchange alternate link of main resource can be used both by the crawlers and the UAs. | ||||||||||
- When the crawlers detects the signed exchange alternate link, the crawlers can fetch the signed exchange. And when a user is browsing the aggregator site (https://feed.example) and it has a link to the article, the signed exchange can be used for [privacy-preserving prefetching](https://wicg.github.io/webpackage/draft-yasskin-webpackage-use-cases.html#private-prefetch) using a prefetch `<link>` element and `<a>` link to the signed exchange . | ||||||||||
``` | ||||||||||
<link href="https://feed.example/article.html.sxg" | ||||||||||
rel="prefetch"> | ||||||||||
<a href="https://feed.example/article.html.sxg">feed.example</a> | ||||||||||
``` | ||||||||||
- While the user of the UA is browsing an article (article.html), and if there is a signed exchange alternate link, the UA can provide the user with a way to save the page in signe exchange format. The saved file can be used to share with other users. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
### Recursive subresource signed exchange prefetch | ||||||||||
1. A crawler of an aggregator site fetches an article (https://publisher.example/article.html). | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think crawlers are likely to respect subresource signed exchanges. They can just go to the original host, which can offer the signed exchange as a same-document alternative. So remove from here down to "The aggregator site will serve"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||||||||||
1. There is an alternate link of signed exchange of the article in the response header: | ||||||||||
``` | ||||||||||
Link: <https://sxg.publisher.example/article.html.sxg>; | ||||||||||
rel="alternate"; | ||||||||||
type="application/signed-exchange;v=b3"; | ||||||||||
anchor="https://publisher.example/article.html" | ||||||||||
``` | ||||||||||
1. The crawler fetches and verifies the signed exchange (article.html.sxg). | ||||||||||
|
||||||||||
1. The response from the server has an alternate link of subresource signed exchange: | ||||||||||
``` | ||||||||||
Link: <https://sxg.publisher.example/lib.js.sxg>; | ||||||||||
rel="alternate"; | ||||||||||
type="application/signed-exchange;v=b3"; | ||||||||||
anchor="https://cdn.publisher.example/lib.js" | ||||||||||
``` | ||||||||||
1. And the inner response of the main resource signed exchange (article.html.sxg) has a preload header and an [allowed-alt-sxg header](./signed-exchange-subresource-subtitution-explainer.md): | ||||||||||
``` | ||||||||||
Link: <https://cdn.publisher.example/lib.js>; | ||||||||||
rel="preload"; | ||||||||||
as="script" | ||||||||||
Link: <https://cdn.publisher.example/lib.js>; | ||||||||||
rel="allowed-alt-sxg"; | ||||||||||
header-integrity="sha256-XXXXXX" | ||||||||||
``` | ||||||||||
1. The crawler fetches and verifies the subresource signed exchange (lib.js.sxg). | ||||||||||
1. The aggregator site will serve the signed exchanges (article.html.sxg and lib.js.sxg) from their own server. | ||||||||||
|
||||||||||
1. While a user is browsing the aggregator site (https://feed.example), a prefetch link element is inserted because the use is likely to want to read the article. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||||||||||
``` | ||||||||||
<link rel="prefetch" href="https://feed.example/sxg.publisher.example/article.html.sxg"> | ||||||||||
``` | ||||||||||
1. The UA prefetches the signed exchange (article.html.sxg). | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||||||||||
1. The response from the server has an alternate link of subresource signed exchange: | ||||||||||
``` | ||||||||||
Link: <https://feed.example/sxg.publisher.example/lib.js.sxg>; | ||||||||||
rel="alternate"; | ||||||||||
type="application/signed-exchange;v=b3"; | ||||||||||
anchor="https://cdn.publisher.example/lib.js" | ||||||||||
``` | ||||||||||
1. And the inner response of the main resource signed exchange (article.html.sxg) has a preload header and an allowed-alt-sxg header: | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||||||||||
``` | ||||||||||
Link: <https://cdn.publisher.example/lib.js>; | ||||||||||
rel="preload"; | ||||||||||
as="script" | ||||||||||
Link: <https://cdn.publisher.example/lib.js>; | ||||||||||
rel="allowed-alt-sxg"; | ||||||||||
header-integrity="sha256-XXXXXX" | ||||||||||
``` | ||||||||||
1. The UA recursively prefetches lib.js.sxg. | ||||||||||
1. If the user clicks a link the article’s signed exchange, both the main resource of the article and the script are loaded from the prefetched signed exchanges. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||||||||||
|
||||||||||
## Proposal | ||||||||||
While processing preload link HTTP headers in prefetched main resource signed exchange’s inner response: | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Then write an explicit loop that checks if every preload has a matching and allowed prefetch before deciding to use all of the prefetches. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||||||||||
1. Check whether matching “allowed-alt-sxg” link HTTP header in the inner response exists or not. (Note that if the allowed-alt-sxg link HTTP header has variants and variant-key attributes, the UA must execute the algorithm written in [HTTP Representation Variants](https://httpwg.org/http-extensions/draft-ietf-httpbis-variants.html) spec to find the matching header.) | ||||||||||
1. If exists, check whether matching “alternate” link HTTP header in the outer response exists or not. | ||||||||||
1. If exists, prefetches the matching signed exchange instead of prefetching the original resource URL. | ||||||||||
1. The prefetched signed exchange will be stored to the SignedExchangeCache of the Document. And it will be passed to the next Document and used while processing the preload link header. This behavior is written in [Signed Exchange subresource substitution explainer](./signed-exchange-subresource-subtitution-explainer.md). | ||||||||||
|
||||||||||
## Detailed design discussion | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably just remove this sub-header. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||||||||||
### Content negotiation using Variants and Variant-Key | ||||||||||
The **alternate** link header and **allowed-alt-sxg** link headers can have [variants and variant-key](https://httpwg.org/http-extensions/draft-ietf-httpbis-variants.html) attributes to support content negotiation (eg: [WebP support](https://developers.google.com/speed/webp/faq#server-side_content_negotiation_via_accept_headers)). | ||||||||||
|
||||||||||
- In **outer** HTTP response of article.html.sxg from feed.example: | ||||||||||
``` | ||||||||||
Link: <https://feed.example/publisher.example/image_jpeg.sxg>; | ||||||||||
rel="alternate"; | ||||||||||
type="application/signed-exchange;v=b3"; | ||||||||||
variants-05="accept;image/jpeg;image/webp"; | ||||||||||
variant-key-05="image/jpeg"; | ||||||||||
anchor="https://publisher.example/image"; | ||||||||||
Link: <https://feed.example/publisher.example/image_webp.sxg>; | ||||||||||
rel="alternate"; | ||||||||||
type="application/signed-exchange;v=b3"; | ||||||||||
variants-05="accept;image/jpeg;image/webp"; | ||||||||||
variant-key-05="image/webp"; | ||||||||||
anchor="https://publisher.example/image"; | ||||||||||
``` | ||||||||||
- In **inner** response header of article.html.sxg: | ||||||||||
``` | ||||||||||
Link: <https://publisher.example/image>; | ||||||||||
rel="allowed-alt-sxg"; | ||||||||||
variants-05="accept;image/jpeg;image/webp"; | ||||||||||
variant-key-05="image/jpeg"; | ||||||||||
header-integrity="sha256-AAA" | ||||||||||
Link: <https://publisher.example/image>; | ||||||||||
rel="allowed-alt-sxg"; | ||||||||||
variants-05="accept;image/jpeg;image/webp"; | ||||||||||
variant-key-05="image/webp"; | ||||||||||
header-integrity="sha256-BBB" | ||||||||||
Link: <https://publisher.example/image>; rel=preload; as=image; | ||||||||||
``` | ||||||||||
If a UA supports WebP, the UA should prefetch **image_webp.sxg** which content is WebP format. Otherwise the UA should prefetch **image_jpeg.sxg** which content is JPEG format. | ||||||||||
|
||||||||||
## Security and Privacy Considerations | ||||||||||
The UA must fetch the alternate signed exchange subresource (lib.js.sxg) even if there is the original subresource (lib.js) in the HTTPCache. Otherwise it leaks the state of publisher’s site to the distributor of the signed exchange. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, to prevent tracking (user ID transfer), if the aggregator failed to prefetch a subresource that the main resource preloads, the UA must drop all of the subresource prefetches. If the aggregator prefetches a superset of the preloaded subresources, the UA must drop the ones that weren't preloaded. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||||||||||
|
||||||||||
## [Self-Review Questionnaire: Security and Privacy](https://www.w3.org/TR/security-privacy-questionnaire/) | ||||||||||
1. What information might this feature expose to Web sites or other parties, and for what purposes is that exposure necessary? | ||||||||||
- The existence of the alternative signed exchange in HTTP Cache is exposed. | ||||||||||
1. Is this specification exposing the minimum amount of information necessary to power the feature? | ||||||||||
- Yes. | ||||||||||
1. How does this specification deal with personal information or personally-identifiable information or information derived thereof? | ||||||||||
- Signed Exchange should not include personal information. | ||||||||||
1. How does this specification deal with sensitive information? | ||||||||||
- Signed Exchange should not include sensitive information. | ||||||||||
horo-t marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
1. Does this specification introduce new state for an origin that persists across browsing sessions? | ||||||||||
- No. The prefetched signed exchange is stored to HTTPCache. But this is the existing behavior when directly prefetching the signed exchange using `<link rel=prelfetch>`. | ||||||||||
1. What information from the underlying platform, e.g. configuration data, is exposed by this specification to an origin? | ||||||||||
- This exposes whether the UA support this feature or not. | ||||||||||
horo-t marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
1. Does this specification allow an origin access to sensors on a user’s device | ||||||||||
- No | ||||||||||
1. What data does this specification expose to an origin? Please also document what data is identical to data exposed by other features, in the same or different contexts. | ||||||||||
- The existence of the alternative signed exchange in HTTP Cache is exposed. | ||||||||||
- But this is the same as the existing behavior when directly prefetching the signed exchange using `<link rel=prelfetch>`. | ||||||||||
1. Does this specification enable new script execution/loading mechanisms? | ||||||||||
- No | ||||||||||
horo-t marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
1. Does this specification allow an origin to access other devices? | ||||||||||
- No | ||||||||||
1. Does this specification allow an origin some measure of control over a user agent’s native UI? | ||||||||||
- No | ||||||||||
1. What temporary identifiers might this this specification create or expose to the web? | ||||||||||
- No | ||||||||||
horo-t marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
1. How does this specification distinguish between behavior in first-party and third-party contexts? | ||||||||||
- This feature should work well with third-party signed exchange. | ||||||||||
- To avoid leaking the state of publisher’s site to the distributor of the signed exchange, the UA must fetch the alternate signed exchange subresource even if there is the original subresource in the HTTPCache. | ||||||||||
1. How does this specification work in the context of a user agent’s Private \ Browsing or "incognito" mode? | ||||||||||
- No difference while the user is browsing sites in Private mode. | ||||||||||
1. Does this specification have a "Security Considerations" and "Privacy Considerations" section? | ||||||||||
- Yes | ||||||||||
1. Does this specification allow downgrading default security characteristics? | ||||||||||
- No | ||||||||||
horo-t marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done