WebBluetoothCG / web-bluetooth

Bluetooth support for the Web.
http://www.w3.org/community/web-bluetooth/
Other
1.37k stars 185 forks source link

Access device MAC address #583

Open Milooooo1 opened 2 years ago

Milooooo1 commented 2 years ago

Hi! I am working on an application where I need the mac address of my device so that I can synchronize it with another device (For the people interested, the device I am talking about is an Xsens DOT sensor).

However from reading issue 417 its clear to me we do not have access to the device its MAC address. My question is if this is able to be added to the Web Bluetooth API? So far I've found out that the Windows Bluetooth API and Android Bluetooth API do allow you to get the device its MAC address where macOS and IOS do not. I've found nothing about chromeOS.

nondebug commented 2 years ago

I think the Bluetooth device address (and MAC address) cannot be exposed through the API because some platforms do not provide the device address or provide a synthetic identifier that is not useful for re-identification.

In general, web platform APIs should not expose persistent device identifiers that cannot be reset by clearing the browser's local state. See Mitigating Browser Fingerprinting in Web Specifications. Bluetooth device addresses are typically permanent identifiers set in hardware. The device address is intended to be globally unique, making it a significant risk for active fingerprinting.

To mitigate fingerprinting while still allowing re-identification of previously connected devices, we should develop an opaque, persistent identifier that can be invalidated when local state is cleared. This would also enable us to expose an identifier on platforms where the device address is obscured.

I think this may not be sufficient for your use case. Can you describe more about how you intend to use the identifier for synchronizing devices?

Milooooo1 commented 2 years ago

Thank you for the detailed answer @nondebug. I understand why it's not possible to access such an identifier. The problem is that according to the Xsens documentation specifically calls for the MAC address of the root sensor this can be seen in the full document which you can download here or in the screenshot below. Screenshot_2022-04-14-20-59-38-49_e2d5b3f32b79de1d45acd1fad96fbb0f

nondebug commented 2 years ago

Ah, so the Xsens sensor needs the actual MAC address. In that case you will need to find a workaround, for instance looking up the device address in chrome://bluetooth-internals on platforms where the address is provided.

KOLANICH commented 2 years ago

I vote against exposing MAC. If it is strictly needed, add a text field asking user to type/copy from the needed place in settings.