-
Notifications
You must be signed in to change notification settings - Fork 58
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
Cross-spec device identification & association #64
Comments
Other specs that should participate in these group IDs: |
USB has recently introduced the concept of a "container ID" that is designed to provide a unique identifier for a physical device across the various components within it and external connections it has. For example, a USB printer that also has WiFi can be recognized as the same device no matter how it is connected. |
Since I'm mentioned here, I should point out that I'm not sure tying ids from different APIs together is necessarily a good idea. What I meant to illustrate with the detail I gave in the other issue was the varying requirements around ids in specific APIs, as well as the privacy sensitive nature around them with regard to unintended use or misuse, as well as to their lifetimes. With all those needs in play, adding lateral dependencies across specs, with perhaps additional uniformity needs, I worry may create limitations that aren't inherent in any one API alone. Others probably have their own ways of judging how things are best organized, but I personally lean towards chasing real specific use-cases, like the headset one, and I tend to run in the opposite direction of general symmetry for its own sake, as I find there's usually a cost associated with any discipline. |
@travisleithead at Boston f2f: |
Is there already some best practice thinking that we could ... er... reference... |
Some thoughts from the minutes:
|
Discussed this a bit at the Melbourne face-to-face (afternoon of Wednesday January 13). Seems like there's a desire to have a document describing these principles, and Travis will work on drafting that. |
(specifically adding said principles to the existing design-principles doc) |
Taken up at london f2f. |
@travisleithead to do some prep-work ahead of time for a discussion 5/23. Also related to WebUSB #108 and web bluetooth. |
On availability of device/group ids:
On correlation:
On persistence:
On device/group hierarchy:
API for device id persistence: Just food for thought. Something relatively trivial, async-based (to allow for permission prompt), and which allows for subsequent checking on a previously-generated persistent id (since these may be cleared at the UA's discretion). partial interface Navigator {
Promise<DOMString> getPersistentDeviceId(DOMString deviceId);
Promise<boolean> hasPersistentDeviceId(DOMString persistentDeviceId);
}; With the 'get' API, a non-persisted device id (all of them by default, ideally) is provided, and the UA asks for permission to persist it. If granted, a new persistent id is generated by the user agent, persisted associated with the origin, and returned. The same persisted id, if passed to the 'has' method answers true or false, if the UA knows about it (still). It's async to allow the UA to implement mitigations against frequent requests like exponentially increasing time-out periods between fulfilling the promise. Presumably, the 'get' API would return the same persisted id when called with the same device id multiple times. |
Discussed on TAG call 2017-05-30. |
Adding some folks for their thoughts: @jyasskin, @zolkis, @reillyeon, @jan-ivar, @marcoscaceres, @anssiko, @mounirlamouri In recent TAG discussion we looked at a variety of topics around device ids, but the one that gathered the most attention was the question of persistence. Our goal is to try and understand the complexities, and then try to establish cross-spec guidance around persistence of device ids (see #64 (comment)). Two schools of thought have been suggested:
In both cases, it would be desirable that clearing the browser settings/storage would clear any persistent ids/cause new unique ids to be used/break the persistence. Qs:
|
I don't think we have looked a lot at persistence yet. Selection (with filters) seems to work fine for Web Bluetooth and Web USB. Also when plugging in a USB device, a dialog appears which takes you to the URL (Physical Web for Bluetooth), which may allow to auto connect, which at least is the plan for Bluetooth. In general we are trying to avoid permission dialogs. Too many may teach users to always accept, and only slightly annoying non-modal permission drop downs (like in Chrome) makes sites prompt way too early. On the other hand, no site would want to show a modal device selection dialog at the wrong time. |
@tobie for sensors, groups might make sense, especially if we talk about connected sensors, ie. a laptop might have accelerometer and gyroscope, but when you connect a VR headset (let's say a cabled one in this case), then that headset might have the same and you want to make sure to use those for your use-case. Same might happen if we expose sensors over Bluetooth, ie a specialized VR controller, like a lasergun or sword. Also with modular phones (like the newly announced Essential phone, to which you can attach modules which becomes part of the phone over a USB protocol) this might become more important |
Discussed again at London F2F. I'm inclined to recommend the alternative mentioned above about device ids being persistent by default. Next step is to write this guideance up in the design principles doc and seek wide feedback there. Issue w3ctag/design-principles#69 will track putting these guidelines into design principles. |
Took-up at 2017-09-05, doesn't appear to be any disagreement, so will work on getting this guideline into the design-principles doc. |
@travisleithead I'm sorry, I've been waiting for something more concrete in w3ctag/design-principles#69 to review, but nothing has materialized so far. Of the two schools of thought, the first one seems like a red herring, as having a super-cookie that works as an identifier across all domains seems like a bad idea, even behind a user-prompt. The second school appears to tie the concept of origin-unique IDs, which are always a good idea IMHO, with the idea that these should be persisted by default.¹ That seems like a false choice to me. Instead, the options to consider here seem to be opt-in vs. opt-out vs. always persisted (I trust clearing cookies erases IDs regardless). MediaCapture is an example of implicit opt-in in Firefox. That is, origin-unique deviceIds are only given to sites the end-user indicates an elevated level of trust with (e.g. sharing mic or camera). This critically leaves out the drive-by web. There are normative requirements on browsers that forgo this: "[When permission is lacking]... the user agent MAY clear this identifier once the last browsing session from this origin has been closed. If the user agent chooses not to clear the identifier in this condition, then it MUST provide for the user to visibly inspect and delete the identifier, like a cookie." Specifically, the concern was creating a new class of persistent identifier without visibility. Will the guidelines (about to be) given here, run afoul of this concern? 1. Or at least "to enable persistence by default", which is not the same thing as recommending it. Are we merely recommending origin-uniqueness here, in order to let browsers that so wish to persist by default, or are we recommending all browsers persist by default? I can't tell. |
We're developing several specs that interact with physical devices. Several of these specs provide IDs for their devices to let web developers associate properties with the devices over time. MediaDeviceInfo takes the extra step of providing separate IDs for the "device", meaning a particular microphone, camera, speaker, etc., and for the "group", meaning a collection of devices on the same physical hardware. But media devices aren't the only thing that can come in a group, so we should be thinking about how to let web developers associate device groups between different specifications.
A particular use case for this is associating a headset's audio channels with the headset's Bluetooth settings channel.
@jan-ivar was kind enough to write down in w3c/mediacapture-main#202 some of the properties of the existing IDs:
MediaDeviceInfo.groupId
is not persisted to disk, but stable within a browser-session and not origin-unique.MediaDeviceInfo.deviceId
is origin-unique, and persistent only when permission is granted: Persist deviceIds only after gUM permission grant. w3c/mediacapture-main#218MIDIPort.id
- is persistent but may not be origin-unique.BluetoothDevice.id
is origin-unique, not available at all until permission is granted, and persistent until permission is revoked.Unless someone argues otherwise, I'm going to treat any lack of origin-uniqueness as a bug.
As an initial base for discussion, I'd suggest that we add a
groupId
property to at leastBluetoothDevice
, and specify that it's shared withMediaDeviceInfo
.I think we don't need the
groupId
to persist across browser sessions as long as the individual devices in a group do have persistent IDs, but it might be easier for developers if it is persistent. Do we make platform evolution harder in any way if the group ID is persistent?Where should we put the algorithm for generating group IDs? How do we word that? I don't think we can specify how a UA figures out that two devices are in the same group: it'll depend a lot on the connection technologies.
The text was updated successfully, but these errors were encountered: