WICG / ua-client-hints

Wouldn't it be nice if `User-Agent` was a (set of) client hints?
https://wicg.github.io/ua-client-hints/
Other
591 stars 77 forks source link

Make Sec-CH-UA-Form-Factor a future proof way of selecting content #344

Closed nielsbasjes closed 1 year ago

nielsbasjes commented 1 year ago

As proposed here by @djmitche (CC: @miketaylr) a new issue to discuss my ideas for a possible future proof way for the Sec-CH-UA-Form-Factor header.

My overall proposal is to make the Sec-CH-UA-Form-Factor header a clear future proof indicator on the kind of content and interaction is suitable for the device/client the user is using at the moment. So in addition to indicating the things we see today it should also be extensible into future developments (like contactlens screens, brain interaction, ...).

From the browser perspective this header is its indicator to tell the website what is the best content it can consume. I think this should be present on the first request. Which makes it something that should be allowed into the low entropy group and cannot contain any detail about the device.

So in the below proposal for this header is where I'm trying to stay at useful detail without going into fingerprinting detail (which is a tricky balance).

Note that this also makes the Sec-CH-UA-Mobile effectively an extreme simplification of this header (perhaps in time even obsolete).

Essentially a site needs to know from the device:

More extensively the kinds of values I have in mind:

The Output capabilities/ScreenType/Size indicator

NOTE: The above list needs discussion as it still mixes screen size and content capabilities.

The Interaction capabilities indicator (multi valued)

If multiple interaction capabilities are present these should be always in alphabetical order to reduce fingerprinting.

The Attention level indicator

Kinds of field values I would expect

Device Screen/Content Interaction Attention
Watch Watch Touch;Location;Orientation High
Phone Phone Touch;Location;Orientation;Camera High
Tablet Tablet Touch;Location;Orientation;Camera High
Amazon Echo Tablet Touch Medium
PS5 TV Game High
Nintendo Switch Phone Game High
Tesla Tablet Touch;Location Low
Google TV TV Remote Medium
Apple Vision Pro XR Gesture;Orientation;Camera High
PS4 VR Headset VR Gesture;Orientation High
PS5 VR Headset XR Gesture;Orientation;Camera High

Note that it may seem to add a lot of entropy but I think it doesn't because just about all phones will have the same list here and from the other headers it is already known to be a phone. Same for all Tablets, all game consoles, etc.

To be discussed: How to fit this into the header.

Sora2455 commented 1 year ago

Note that it may seem to add a lot of entropy but I think it doesn't because just about all phones will have the same list here and from the other headers it is already known to be a phone. Same for all Tablets, all game consoles, etc.

This logic is backwards - if most people have similar values and then a small group have very different values, then this makes it far easier to identify that small group.

miketaylr commented 1 year ago

I think this should be present on the first request. Which makes it something that should be allowed into the low entropy group

Given the high-entropy nature of this proposal (i.e., there's a lot of info here that can't be passively derived), I don't think we would send it by default. And +1 to what @Sora2455 is saying.

As to "Output capabilities/ScreenType/Size indicator" - this is basically the original proposal of the form-factor hint. Should we really be sending more info/bytes over the wire than this (interaction/attn) for use cases that aren't interested in it (e.g., analytics)?

djmitche commented 1 year ago

I like that this is getting down to the "facts" about the UA/device, rather than interpretations or industry trends. And, I think the three dimensions outlined here are good: Output, Interaction, and Attention.

I'd like to get more feedback from other sites that might want to use this value. While that's in progress, a few comments of my own:

nielsbasjes commented 1 year ago

Note that it may seem to add a lot of entropy but I think it doesn't because just about all phones will have the same list here and from the other headers it is already known to be a phone. Same for all Tablets, all game consoles, etc.

This logic is backwards - if most people have similar values and then a small group have very different values, then this makes it far easier to identify that small group.

Ah yes, I see your point.

miketaylr commented 1 year ago

Looking forward to the feedback you get @djmitche. With my editor hat on, my preference is to keep it simple and informed by use cases, and possibly add additional info in the future.

djmitche commented 1 year ago

Classifying the use-cases I've uncovered so far:

The analytics cases are wanting to cover the universe of user agents contacting a site. The variants and wrappers cases are user agents wanting a way to say "this is new and different in a way that is significant to at least one site and probably others".

To the three dimensions:

To Mike's point about simplicity, it seems reasonable to drop the Output and Attention dimensions, leaving only a single dimension. The spec language should probably describe what that represents as a way of constraining what new values are added.

That leaves:

I have some opinions on those but would be interested to hear reactions to this summary before voicing them.

djmitche commented 1 year ago

Perhaps I'm looking for feedback too early (in an issue, before making a PR to a draft spec!). Here are my opinions, which I will formulate into the existing PR, #343.

@arichiv gave a nice illustration of how allowing values to encompass others, and representing a set of values, supports future expansion.

miketaylr commented 1 year ago

LGTM as a plan @djmitche

djmitche commented 1 year ago

Fixed in #343, but I can't close this issue.