Git Product home page Git Product logo

client-hints-infrastructure's Introduction

Explainer

Client Hints is collection of HTTP and user-agent features that enables privacy-preserving, proactive content negotiation with an explicit cross-origin delegation mechanism:

  • Proactive content negotiation at the HTTP layer (defined in the IETF RFC) enables servers to request delivery of specific hints, in order to enable optimized and automated selection of resources based on a user's device, conditions and preferences, and lets clients decide which hint requests they want to grant, with per-hint and per-origin granularity.
  • Integration of said mechanism with web concepts (defined in this specification) specification) enables browsers to benefit from content adaptation, and have it play nicely with current web restrictions (e.g. same-origin policy).
  • The opt-in nature of the mechanism enables browsers to advertise requested hint data (e.g. user agent and device characteristics) selectively to secure-transport origins, instead of appending such data on every outgoing request.
  • Origin opt-in applies to same-origin assets only and delivery to cross-origin origins is subject to explicit cross-origin delegation via Feature Policy, enabling tight control over which cross-origin origins can access requested hint data.

The goal of Client Hints is to reduce passive fingerprinting on the web while enabling scalable and privacy preserving content adaptation between client and server, via a standardized set of content negotiation primitives at the HTTP and user agent levels.

This document outlines the Client Hints infrastructure, explains it at a high level and points to the various specification and draft proposals in which it is officially defined. It does not describe the various features and hints which rely on this infrastructure. They will be defined in their respective specifications.

The Client Hints infrastructure

How can servers opt into receiving hints from the client? How should clients send those hints? And how should that be handled across origins?

Opt-in mechanism

In order to receive Client Hints, servers must opt-in by using the HTTP response headers described in the sections below. For security and privacy reasons, the opt-in must be received on the response of the top-level navigation, over a secure connection. Servers can similarly opt-in by using the headers' HTML equivalents, the <meta> HTML tag and its http-equiv attribute.

Accept-CH

The Accept-CH header enables servers to request specific hints from the browser. The header's value is a comma separated list, where each value in that list represents a request header hint that the server is interested in receiving.

If a server's response to a navigation request includes the Accept-CH: foo, bar header, same-origin subresource requests on the page will include the Sec-Foo: foo-value and Sec-Bar: bar-value request headers unless the client has reasons to avoid sending that information to the server.

Delegate-CH

The Delegate-CH <meta> HTML tag enables top level frames to request specific hints from the browser. The header's value is a semi-colon separated list (akin to the Permissions Policy syntax), where each value in that list represents a request header hint that the server is interested in receiving.

If the HTML response to a navigation request includes the <meta http-equiv="Delegate-CH" value="Sec-Foo; Sec-Bar"> tag, same-origin subresource requests on the page will include the Sec-Foo: foo-value and Sec-Bar: bar-value request headers, unless the client has reasons to avoid sending that information to the server.

Same-Origin Policy

There are three important restrictions on the opt-in mechanism description above:

  • opt-ins will only be granted when the opt-in headers are received with a top-level navigation resource
  • after the opt-in, hints will only be sent with same-origin requests
  • any Delegate-CH <meta> HTML tags injected by javascript will be ignored

Why are these limitations important?

As mentioned before, we don't want the mechanism to be used to increase fingerprinting on the web. The information that Client Hints provide should generally be available through Javascript APIs (see the Privacy Considerations section for more details).

That means that for active resources (e.g. HTML), Client Hints does not increase the active fingerprinting surface. Servers serving active resources can already exfiltrate the data that hints provide, via scripts, styles or certain elements (e.g. <img srcset>). Client Hints only provides servers with a more convenient and performant way to get that information for content-negotiation purposes and ensures that authors and user agents have ultimate control over which servers get what information.

Client Hints also allow this information to be collected on passive sub-resources (e.g. images). We don't want cross-origin origins to be able to exfiltrate data about the client/user without explicit permission from the top-level origin. And we certainly don't want them to be able to exfiltrate it cross-origin, beyond the lifetime of the current navigation.

Therefore, by default, Client Hints opt-in is only valid when delivered on top-level navigation requests before any scripts execute, and, by default, applies only to same-origin resources. Cross-origin requests must only receive hints when explicit permission is given by the top-level document's origin.

Cross-origin hint delegation

Why do we need cross-origin Client Hints?

As the purpose of for client hints is to enable content negotiation at scale, and as many optimization services are offered over different origins than the main page's origin (e.g., CDNs, resource-specific hosting services, or dedicated, resource-specific, first-party sub-domains), cross-origin support is a vital part of Client Hints.

In order to support these use-cases, we have defined delegation of Client Hints cross-origin, using a HTTP Permissions Policy or HTML Feature Policy.

HTTP Example

A server sending the following header Permissions-Policy: ch-example=( "foo.com" "bar.com"), ch-example-2="foobar.org" as part of a top-level navigation response will delegate the example hint to the "foo.com" and "bar.com" origins and example-2 to the "foobar.org" origin. So, the client would know that it had explicit permission from the top-level origin to send these hints cross-origin, so that these cross-origin origins could perform content adaptation based on them.

HTML Example

A top level frame containing the following <meta> HTML tag: <meta accept-ch="Delegate-CH" value="sec-ch-example foo.com bar.com; sec-ch-example-2 foobar.org"> will delegate the example hint to the "foo.com" and "bar.com" origins and example-2 to the "foobar.org" origin. So, the client would know that it had explicit permission from the top-level origin to send these hints cross-origin, so that these cross-origin origins could perform content adaptation based on them.

Privacy implications

Why is it privacy-safe for pages to delegate hints to certain cross-origin origins?

Since we're treating Client Hints as an active fingerprinting equivalent, we are comfortable with the information it exposes to the top-level origin, as the same information is already freely available in the equivalent Javascript APIs. Similarly, cross-origin delegation is safe because top-level origin are already able to use other means (such as link decoration), to achieve the same information sharing cross-origin, in less convenient and performant ways.

Further, the HTML delegation can only occur when the <meta> HTML tag is not injected via javascript, ensuring scripts cannot delegate hints in ways that relax the restrictions the top-level content author did not permit.

In short, top-level origins already have the power to share information about the client cross-origin. Cross-origin delegation of Client Hints provides a cleaner pathway for that sharing, and ensures that top-level origin, and ultimately clients, are aware and in control of what is being shared with who.

Sec- prefix

Adding new request headers increases the risk that legacy server systems already use those values for a different purpose. Changing the request header values that such legacy systems receive may result in server bugs.

While that risk is significantly mitigated by the opt-in mechanisms of Client Hints (as servers would be opting in to get Client Hints headers), we feel it is required to mitigate it even further. So, Client Hints request headers should be preceded by the Sec- prefix.

The Sec- prefix also ensures that these headers are only generated by the browser and not added by potentially-malicious developers. That gives servers further guarantees when processing those headers. It may also enable us to simplify the related Fetch processing model, as it clearly indicates that these are headers that were added by the user agent.

Caching considerations

When adapting content to specific Client Hints request headers, servers should add the Vary header to their responses, with a value of each Client Hint header used, in order to indicate such adaptation to caches, and make sure that Client-Hint-negotiated resources are not cached using only their URL as the cache key.

This is also the reason that each Client Hint is represented using a separate header. Ensuring that each hint has its own header reduces cache variance in responses that may rely on some hints, but not others.

Security and privacy considerations

There are a few key mechanisms we already discussed that are part of the Client Hints infrastructure, which enable secure and privacy-preserving deployment of Client Hints:

  • Server opt-ins must be delivered on a top-level navigation request, over a secure connection.
  • Hints are only delivered with same-origin requests, over a secure connection.
  • If the top-level origin wants hints to be delivered to certain cross-origin origins, the top-level origin can explicitly delegate specific hints to specific origins.
  • Hints are Sec- prefixed, to provide servers with more confidence regarding the values they deliver, as well as to avoid legacy server bugs.

Beyond that, when implementing Client Hints, browsers should make sure that certain privacy-related precautions are being taken:

  • Client Hint features should not be shipped unless there is a Javascript-based equivalent API, which enables developers access to the same data and is deemed privacy-safe to ship
    • This follows Extensible Web principles — we want the shipped features to be polyfillable (Even if Sec- headers cannot be added by developers)
    • As discussed above, from a privacy perspective, we consider Client Hints to be a potential active fingerprinting vector equivalent. Therefore, it is only safe to ship it with hints that provide information which is already available through other active fingerprinting means, such as a Javascript API.
  • Browsers should turn off hints when users choose to turn off Javascript
    • If the user has turned off Javascript, Javascript-based active fingerprinting vectors have been disabled. Since that could have been the user's intention when turning off scripting, browsers should similarly turn off Client Hints.
  • Browsers can choose to omit or to lie about certain Client Hints to increase their users' privacy
    • Browsers are free to take privacy-enhancing heuristics into account when deciding to respect the server's opt-in to receive them. Similar heuristics can also be used when deciding what values to send.

Motivation and trade-offs

Proactive content negotiation and its benefits

When choosing a solution that will provide alternative resources to the user's browser based on various factors, we are faced with a design dillema: Either the developer can provide the browser with a list of all potential URLs and let the browser choose the best one, or can use content negotiation and let the server pick the best-fit resource variant.

The former option certainly has its place, and it is used successfully across the web in examples like <picture>, srcset, <video>, etc.

At the same time, there are some use-cases where it is not sufficient. Transformation and adaptation of the page's subresources in a manner that is independent from the page's markup can result in more scalable solutions, that don't have to be assimilated into markup related workflows.

By decoupling the resource selection from markup, we can enable external services to perform those transformations automatically. We can also provide a wider range of resources, as offering more resources may result in some server-side costs, but those costs are not directly exposed to the user in the form of markup bloat.

There are many potential dimensions by which we'd want the content adapted to the user:

  • Device characteristics
    • Screen dimensions
    • Screen density
    • Memory and CPU capabilities
    • Range of colors the screen can display
  • Browser characteristics
    • User Agent major or full version
    • Device model, OS version and platform
    • Supported formats and codecs
  • User preferences
    • Data-saving preferences
    • Preferred language
  • Network conditions
    • RTT
    • Effective bandwidth

The list above is not necessarily exhaustive, but it can give us an idea as to why simply providing the browser with (possibly very long) list of resources which have been adapted across multiple dimensions of variability may not be practical, at least in some cases.

An opt-in solution and its tradeoffs

Client Hints requires that servers explicitly advertise and request sets of hints that they would like to receive. This makes such requests explicit and does not enable passive fingerprinting using those hints, which is one of the key and guiding requirements for Client Hints.

Indiscriminately broadcasting user data carries other downsides, as well. Exposing all details and adaptation dimensions to all servers runs a risk of bloating request headers. There are many potential details that can be useful for content negotiation, and we expect that list to grow over time. Sending all of the hints all the time can quickly result in bloat, and make requests significantly larger than they should be. To avoid that, it is more efficient for servers to specifically request the headers that they would take into account, and for client to only send these hints with outgoing requests.

Unfortunately, that decision doesn't come without tradeoffs. Client Hints as an opt-in mechanism currently means that content adaptation of the initial navigation request on the very first view is not possible, at least not without hacks.

At the same time, for features which are critical for content negotiation of navigation requests, browsers may choose to send hints regardless of a server opt-in, when they deem that the information in question doesn't increase the passive fingerprinting surface.

Note: there may be other, out-of-band, opt-in mechanisms in the future that could enable delivery of hints on first navigation to new origins, such as Origin Policy.

Privacy enhancing content negotiation

Content negotiation is typically viewed as a mechanism that enables passive fingerprinting, by adding different bits of data to different user's requests, by default, and enabling servers to use those differences to tell users apart without leaving any trace of that activity.

Client Hints’ opt-in mechanism enables us to avoid this problem, as servers need to tell the browsers which information they need, making any such use of fingerprinting detectable.

But, Client Hints can also enable us to do more than that for user privacy, and turn passive-fingerprinting-enabling content-negotiation mechanisms (e.g. The User-Agent or Accept-Language request headers) into opt-in-only mechanisms. Restricting the amount of entropy that browsers send by default would effectively reduce the passive fingerprinting surface on the web, and Client Hints’ opt-in mechanism would enable browsers to keep closer tabs on entities that use that information for seemingly nefarious reasons.

Conclusion

Client Hints provides a powerful content negotiation mechanism that enables us to adapt content to users' needs without compromising their privacy. It does that by requiring server opt-in, which guarantees that access to the information requires active and tracable action on the server's side. As such, the mechanism does not increase the web's current active fingerprinting surface.

The Client Hints infrastructure can be further used to reduce the web's passive fingerprinting surface, by converting common use-cases for today's passive fingerprinting vectors (e.g. the User-Agent string) into Client Hints which require a specific opt-in.

client-hints-infrastructure's People

Contributors

abeyad avatar amtunlimited avatar arichiv avatar beaufortfrancois avatar clelland avatar davidben avatar domfarolino avatar eeeps avatar foolip avatar koba04 avatar martinthomson avatar miketaylr avatar tomayac avatar yoavweiss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

client-hints-infrastructure's Issues

Add a registry for features that rely on the CH infrastructure

We need a registry of all the features that rely on CH in order to:

  • Have their values be included as valid CH tokens
  • Determine if they are high or low entropy, to know if they should be included by default or require an opt-in
  • Define the related feature policies for HTML

Such a registry should be separate from the infrastructure spec, but can live under the same repo, to make things simpler.

Potential race condition in remove client hints from redirect if needed algorithm

The remove client hints from redirect if needed algorithm uses the request's client's client hint set to determine the headers to remove. If that set has changed since the headers were added, this would miss some cases.

I'm not sure whether the set can change as currently written, but it may end up changing depending on how service worker contexts end up working. Either way, it seems more robust to just loop over all CH headers.

Expose "client hint token"

In the spec, "client hint token" is defined but not exported. Is there any reason you don’t want to export it?

How do you define the Privacy Budget?

Hi,
I am writing on behalf of the dedicated IAB France taskforce working on sandbox, we are having an issue to understand how you will define the Privacy Budget?

Define interaction between reliability and navigation timing API

Something we should make sure to get right, and also to write down in the spec:

The navigation timing API should reflect any time spent in Critical-CH retries so sites can monitor performance. Certainly navigationStart should start before all the retries. From there, given that retries can be interleaved with redirects, I'm thinking we can model these as self-redirect and include them in the redirectStart to redirectEnd block. Looks like Navigation Timing 2 extends this with a redirectCount property, which we'll need to define:
https://www.w3.org/TR/navigation-timing-2/

@yoavweiss, thoughts?

Interaction with Permission-Policy for non-subresource requests?

In Request processing the hints in the hintSet are checked against permission policy only if the request is a subresource request. Are hints expected to be checked against Permission Policy when the request is a non-subresource request (e.g., a request who's destination is iframe)? I would expect requests for embedded iframes to also check against Permission Policy and that's what I've observed when testing in Chrome.

It's possible I'm just misunderstanding the fetch definition of non-subresource request. What I've observed in testing matches my intuitive understanding of a "subresource" request as an embedded request and a non-subresource request as a top-level document request. But fetch's definition seems more narrow than that.

How do we deal with a Critical-CH hit in the middle of a redirect chain?

What should happen if, for example, the CH requirements change midway through a long redirect chain? The way I see it, there's two options:

  1. Restart the request you're currently on, just with the new hints
  2. Restart from the beginning of the chain with the new hints

I don't know if there's any precedent to go off of here. 1 seems like the simplest to spec and implement, and is how I would interpret the proposal right now. Number 2 might have useful merits semantically, however. Are there any strong feelings one way or the other?

@davidben, who might have opinions.

Client hint set for navigation requests

It doesn't look like the spec ends up populating the client hint set for navigation requests. The Accept-CH cache is queried at initialize the Client Hints set, which happens at document creation, after the fetch. I think we'd need to do the lookup before issuing the navigation.

In append client hints to request, we use the request's client's client hint set. I'm actually not sure what that is for navigations. Looks like it's based on sourceBrowsingContext? Is that the navigation initiator or the document currently in the window? Either way, probably not the set we want.

Provide an opt-in for the very-first-view

The current mechanism doesn't enable providing an opt-in to client hints before the navigation request to the very-first-view of a certain origin is triggered.

For hints that are critical for the generation of that navigation response, that may mean that the site would either forfeit the hints, redirect the browser in order to receive the hint, or will perform content adaptation on the client side. Neither of those is ideal.

We should provide a mechanism that enables very-first-view adaptation without the performance tradeoff.

Handling of child frames

I'm not sure if the frame handling is quite right, if I'm reading the spec correctly:

The algorithm for initializing the Client Hint set only fills things in on top-level frames. Which I think means that requests within subframes won't pick up any hints in step 1 of append client hints to request.

Additionally, step 2 says the Permissions-Policy check happens on subresource requests, but that doesn't include the subframe navigation itself.

Does it work to say that child documents inherit the top-level document's client hint set? Then we fix the check in step 2 to cover all requests but the top-level navigation? (Or can we just say all of them? I don't know how permissions policy works those requests given the document's still being created.)

Document behavior for empty/falsy low-entropy hints.

To reduce header bloat, the approach of not sending headers by default whose value is ?0 seems reasonable. Fetch Metadata's Sec-Fetch-User header is a good example of this.

This might be a good rule to agree upon, and document both here in the infrastructure doc, and in the implementation of each low-entropy hint which might have a falsy value.

Impact on same-origin policy

These new headers increase the size of an HTTP request and coupled with attacker-controlled headers or header values could be used to carry out certain cookie-size sniffing attacks.

Privacy measures in browsers might invalidate some of these attacks, but the privacy boundary is typically not the origin, at least in today's implementations.

Should `<meta name=accept-ch content>` be parsed like HTTP `Permissions-Policy` or HTML `allow`?

  • The spec (step 11) points to Permissions Policy's Parse a policy directive algorithm, which parses the HTML allow attribute.
  • allow has a different syntax than the HTTP Permissions-Policy header, which relies on Structured Field parsing.
  • Chrome is shipping with <meta name="accept-ch"> syntax that resembles Permissions-Policy/Structured Fields, with at least one subtle difference: origins can't be quoted, as sf-strings are.

Here's what I got to work in shipping Chrome:

<meta name="accept-ch" content="sec-ch-dpr=(self https://o.img.rodeo https://res.cloudinary.com), sec-ch-width=(self https://o.img.rodeo https://res.cloudinary.com)">

Here's what I would expect, based on the spec:

<meta name="accept-ch" content="sec-ch-dpr 'self' https://o.img.rodeo https://res.cloudinary.com; sec-ch-width 'self' https://o.img.rodeo https://res.cloudinary.com">

(although I'm not 100% on what quotes go where, honestly. luv 2 interpret ABNF...)

I see three ways forward:

  1. Chrome changes its implementation to match the spec, using theallow parsing rules (too late?)
  2. The spec changes, so that the content attribute is parsed using the Permissions-Policy sf-header rules, and Chrome updates its implementation to eliminate any subtle differences (e.g. sf-string quoting... perhaps others?)
  3. The spec changes to document the <meta name="accept-ch"> parsing rules that are shipping in Chrome, which match neither allow nor Permissions-Policy.

I'd prefer 1 over 2 over 3, but if there's any usage, we may be stuck with 3.

Best practice for managing hints throughout multiple requests

The Accept-CH header acts as a complete replacement for the client hints that the browser should send on subsequent requests. I'm unsure of the right process sites (especially larger site with multiple teams) should follow when managing a selection of hints across the lifetime of the session. This is especially pertinent as the selection of valid hints expands to cover a range of different functionality.

For example:

  1. Browser requests /
  2. Site responds Accept-CH: DPR, Width, Viewport-Width
  3. Browser sends DPR, etc. on subsequent requests which get used for image optimisation
  4. Browser requests /downloads
  5. Site responds with Accept-CH: UA-Platform
  6. Browser sends Sec-CH-UA-Platform which is used to customise download options, but no longer sends DPR, etc.

My thoughts for best-practice here is that while the hints are persisted for the session or until a new set is assigned, developers would do better to think of them as specified per navigation. In other words, always send the complete set of hints required for a given page.

Alternatively, use the hint on a given page to set some site controlled variable that can be persisted independently. e.g. a game uses its /detect-settings page to examine the Device-Memory hint and then sets its own internally managed "quality" preference.

This also allows for advising sending a blank Accept-CH header to "reset" state, for example perhaps when a user signs out of a site.

In contrast, I think it would be good to specifically discourage:

  • just asking a big static list of all the hints required throughout the site because they're used at some point
  • attempting to match incoming request headers to the relevant Accept-CH value in order to additively specify another hint

Cookie support

Hello!
I have a website that must work without JavaScript, and I am looking into server-side solutions to detect if cookies are enabled.
A solution may be to set a test cookie, use an internal redirect, and check if the cookie is there; but I believe it's possible to do better.

Client hints look like a natural fit: the server could explicitly ask if cookies (or more generally any storage) are enabled by the user agent. What is your opinion on this? How likely is it to add such a hint?

If we go into the details, there should probably be ways to ask more granular questions:

  • storage shared between the client and server (e.g. cookies or the Accept-CH cache)
  • client-side only storage (e.g. localStorage, indexedDb)

Input Modality as a UACH

It would be great to have input modality (mouse, touch, etc) be passed on each request by Chrome as a User Agent Client Hint (UACH). It would help in determining how people use sites and allows for different UIs and the like when users are using different input modalities.

Any interest in creating this as a UACH?

Critical-CH web-platform elements

There are elements of the Critical-CH restart mechanism (from the client hints reliability explainer and HTTP experimental draft that would fit better in web-platform land than in HTTP land (similar to this draft vs RFC8942). @davidben has mentioned this before in davidben/http-client-hint-reliability#4, and the issues mentioned have since been resolved.

Does it make sense to start specifying the web-platform components of Critical-CH? More importantly, should that be an addition to this draft or a new draft that is dependent on this one?

Accessibility hints

Fortunately there is a lot we can already do to improve the accessibility of websites. Client hints may even provide another way to inform us of what a user needs. I do believe there is a risk to privacy (though it would be opt-in), but I believe the gains may be worth it. Hopefully this is the right place - and I didn't read over anything related - for such a discussion.

I'm thinking about headers such as Sec-CH-UA-Perceivable, Sec-CH-UA-Operable, etc. as per WACG

A few examples:

A webpage may use such information to pre-apply certain [changeable] preferences for users, such as font-size, contrast, item spacing. It could also provide a simpler layout, i.e. for screen readers and such. Certain JavaScript events such as mouseover could be adjusted to click, i.e. for certain motor disabilities this may be useful, etcetera.

FWIW, I'm not advocating that developers bypass the WACG or other standards.

Client Hint Reliability: Alignment with TAG Ethical Web Principles

The complexity introduced increases the learning curve for "do-it-yourself" or "individual" developers' when improving performance or optimising their websites. This does not seem to align with Ethical Web Principle "The web must enhance individuals' control and power".

There is a similar concern regarding Ethical Web Principle "The web is for all people". People "on low bandwidth networks and low specification equipment" will be particularly disadvantaged if website publishers lack the skills or time to modify their websites. The proposal risks essential services needed by economically disadvantaged people becoming unavailable. The justification for such impacts must therefore be very high indeed.

In time it will also be important to ensure broad W3C membership support to comply with Ethical Web Principle "The web is multi-browser, multi-OS and multi-device". A route to making this a mandatory standard for all browsers is needed to avoid encouraging "the creation of websites that work only in one browser".

Overall, there are a set of policy and governance questions to resolve prior to any further engineering work being performed on this set of proposals.

Standardize existing client hint naming

Although most newer hints have the new sec-ch- prefix, many older ones are missing this. We should ensure standardized naming across all hints to avoid confusion.

Reconsider http-equiv support

Having to support <meta http-equiv> significantly complicates implementation in browsers (as it forces header parsing to happen in the renderer, resulting in browsers having to trust their renderers).

But:

  • First party CH processing requires the first party to inspect headers, so likely means they can set them as well.
  • Third party CH processing requires the first party to set Feature Policy opt-in headers, so they might as well also opt-in to CH using headers.

Given the above, it doesn't seem that adding a header requirement on the first party will impact deployment complexity (beyond taking legacy content, already opting in through <meta>, into consideration)

/cc @colinbendell & @eeeps for opinions

Using Feature Policy to opt-in, and not just allow

Right now, in order to send third parties client hints, you must:

  1. Allow the sending of specific hints to specific origins (via Feature-Policy) (by default, only the first party is allowed)
  2. Opt into sending specific hints (via Accept-CH)

① alone does nothing. ② seems awful redundant, in third party contexts; why would I ever set something like:

Feature-Policy: ch-dpr image-host.whatever 'self'

without then doing

Accept-CH: DPR

?

Can we make ① do ②, automatically?

Send low-entropy hints on all requests

Current spec says that low-entropy hints are sent without an opt-in only on navigation requests.

That can have multiple implications:

  • First parties have to opt-in in order to get those hints for their subresources.
  • Third parties require delegation in order to get those hints.

That seems overly restrictive, and doesn't match current implementation. I think we should change that.

Enable markup delegation of client hints

We should allow permission policies to be set on Accept-CH meta tags to enable third party contexts to receive client hints. For example:
<meta name="accept-ch" content="sec-ch-ua-platform-version=('self' 'https://foo.bar')">

This would support cases in which third party content is adaptable to the client and such adaptations improve user experience. Variable fonts, color vector fonts, and responsive images could all be enabled by this change.

Here's an early design doc: https://docs.google.com/document/d/1U3P9yvaT1NXG_qRmY3Lp6Me7M5kTnd3QrBb1yFUVNNk/edit

Does empty Accept-CH override the low entropy user-agent hints?

Accept-CH from a server indicates the desired client hint headers. The client can then choose (or not) to send back some subset of the requested headers to the server in subsequent requests.

https://web.dev/user-agent-client-hints/ indicates that the set of headers specified in Accept-CH should last for the remainder of the session (until browser closes). I.e. the client effectively caches the request and keeps on attaching the set of requested client hints.
However the server can set a new value of Accept-CH to replace the original set.

What is inferred, but I would like to confirm, is that none of this applies to the low entropy hints. My assumption is that a low entropy hint will/should always be sent irrespective of what is specified in Accept-CH. So you can't, for example, specify an empty Accept-CH and expect to stop getting Sec-CH-UA

I THINK this is covered by "For each client hints token lowEntropyHint in the registry’s low entropy hint table, append lowEntropyHint to hintSet." - i.e. this happens after whatever else comes from Accept-CH.

Client Hint Reliability and DNS SVCB/HTTPSSVC

Hello all,

I was reading the Reliability draft here and was somewhat surprised to see ALPS listed as an alternative/option, but not the SVCB/HTTPSSVC draft (https://tools.ietf.org/html/draft-ietf-dnsop-svcb-httpssvc-03), nor could I find any mention here on github about DNS-based "solutions" to this problem. It seems there are at least some synergies between client hint reliability and the HTTPSSVC proposal. Has this been discussed elsewhere before maybe?

As I understand it, SVCB/HTTPSSVC records solve a similar problem in that they allow the client to have server-side information before the first real request on a connection to that server (e.g., proposed use cases are exchanging alt-svc information for QUIC or enforcing HSTS). I am however far from an expert on either client hints nor the DNS proposal, so it could be I'm missing something obvious. Still, I'd expect this alternative to be at least mentioned in the Reliability document, even if it can't/won't be used.

From my reading of the mailing lists and especially comments from people in the quicwg, it seems there is less enthusiasm for ALPS than there is for HTTPSSVC in the long run from implementers (again, I could be wrong in this). Given that the DNS-based proposal is picking up speed and being implemented/tested by e.g., Cloudflare and Apple (https://blog.cloudflare.com/speeding-up-https-and-http-3-negotiation-with-dns/), this seems like a good use case to try out as well.

Looking forward to hearing your thoughts on this!
With best regards,
Robin

Prefixing of hints or not?

The README.md says:

If a server's response to a navigation request includes the Accept-CH: foo, bar header, same-origin subresource requests on the page will include the Sec-Foo: foo-value and Sec-Bar: bar-value request headers.

Just looking at how this is implemented in Chrome v85. Seems to treat the "classic" client hints differently than ua-client hints. For ua-arch it is indeed prefixed by sec but also by by ch. The classic hints are not prefixed.

Like usual on the web, implementation trumps specification, but wanted to phrase the question too: Any reason why the "classic" (width, dpr, downlink,ect etc...) hints should be treated differently than the ua-client hints?

Should client hints be re-evaluated on redirect

Related to #41, we've got a few other goofy corners of redirect handling. The append client hints to request algorithm is attached to the fetch algorithm, which means it only happens at the start of a redirect chain. Then the remove client hints from redirect if needed algorithm removes hints as needed on cross-origin redirects, but I don't believe hints are ever added on redirect.

But if you navigate to A, which redirects to B, we probably want to pick up B's hint set.

Relatedly, if you make a subresource request from A which redirects through B and C, and A has delegated different sets of hits between B and C, does going from B to C recompute the hint set, or do we only subtract hints. (Right now we only subtract.)

Sec-CH-UA-Full-Version seems to be missing from the spec.

Hi

In Section 7.1 of the spec https://wicg.github.io/client-hints-infrastructure/

It says...
A client hints token is a byte-lowercase representation of one of Save-Data, DPR, Width, Viewport-Width, Viewport-Height, Device-Memory, RTT, Downlink, ECT, Sec-CH-UA-Arch, Sec-CH-UA-Bitness, Sec-CH-UA-Model, Sec-CH-UA-Platform, Sec-CH-UA-Platform-Version, Sec-CH-UA or Sec-CH-UA-Mobile.

But Sec-CH-UA-Full-Version is missing from the list.

Also not mentioned in Section 7.2 or 7.4 either.
Nor in the Section 9 Index.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.