-
Notifications
You must be signed in to change notification settings - Fork 21
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 camera permission requirement to spec? #79
Comments
cc @reillyeon |
@reillyeon I was wondering if you could chime in, I'm not sure how much of the above should be done here and how much should be taken care of in Chromium. @engedy fyi |
I think the resolution was to make requesting the From an implementation perspective however I'd be interested in @engedy's thoughts on how usage of the ALS (without camera) would be presented to the user. We've set up a reasonably good precedent for using tab indicators (and notifications on mobile) for this sort of thing. |
If I've understood it correctly, the idea is to:
Consequently, from an UA perspective, calling
|
I would go so far as to remove the |
Hmm, interesting. I don't have strong objections to the idea, although I don't know if this will confuse users depending on how the UI is constructed (e.g. a website asks for camera access although the camera indicator does not get turned on and no camera access seems to be happening). Let me try to summarize the new proposal:
I wonder if others would like to chime in before I work on a patch? @anssiko @kenchris @larsgk @marcoscaceres @willmorgan @engedy |
Having the ALS work by relying on getUserMedia's side effects doesn't feel right to me, but maybe getUserMedia is actually a better API to use as developers can select the relevant sensor device. If this is for permission only, I'm tentatively OK with this, but I have some questions on how we might provide a more consistent API to developers. Last year I looked into accessing the ALS via getUserMedia, and concluded that it would require some spec changes to provide a consistent API surface. To be clear, I'm actually more in favour of this method now I've had another look. The main reasons were:
That being said, the existing non-GUM spec doesn't let developers specify which sensor to use. For my use case, this would be useful as we need to specify the front facing camera. If the WebRTC WG (assuming this is the correct one?) would be interested in providing some guidance to reshape the API to make it more getUserMedia-y, that would be interesting. If it took this route, I'd be interested in knowing:
|
Interesting points. Last year's decision was about permissions only, but as you said it's not clear how this would work in terms of UI and integration with gUM permissions. Maybe @engedy can provide some insight here from a Chromium perspective. From an ALS perspective device selection isn't a problem since the Generic Sensors APIs do not currently expose more than one sensor of a given type and devices usually ship with a single ALS. Would the API in its current form (i.e. with no integration with gUM) also work for your use case? |
Ultimately it would work in its current form, I'm just thinking about edge cases where we might take action based on the wrong input in the future. As for #64 (comment), I'm not familiar with @larsgk's use case but I don't think car dashboards or ship bridges necessarily have cameras that are accessible. In these scenarios where those devices don't have any video inputs, how should getUserMedia respond? Going by the current spec, it should fail before any permission prompt because video inputs aren't available. |
I agree that relying on a side effect of |
Sorry @reillyeon, I think I got the wrong end of the stick, so thanks for clarifying. If the proposal is that |
I believe so. Do note that calling |
Correct, and as @rakuco said, |
Do you plan to allow access to ALS if access to camera is already granted? Because providing access to the camera if ALS permission is given would grant access to, like, much more information than those from ALS sensor on their own? Aside from the fact that it may be technically confusing to make a hard link between ALS and the webcam, as these are different sensors. Why then, not rename AmbientLightSensor.start() to Camera.start()? |
To reiterate: The proposal is that there will be no ALS permission. Accessing the ALS will require camera permission. |
A patch that basically does
|
Reading back through the OP link to the minutes, I'm not sure I understand the rationale behind moving the permission to camera in order to move this API forward. Looking at @rakuco's notes above it seems that using the same camera permission is going to cause more confusion and edge cases in the wild. Would it be possible for getUserMedia to implicitly grant an ambient light sensor permission instead? Or does that take us back to square one? |
Pardon my ignorance on the details of the Permissions API integration in the Media Capture and Streams spec. I wasn't aware of the deviceId detail because to my knowledge it isn't implemented in Chromium. Is it implemented in any other browser? It does throw a wrench into the plan to simply treat the ALS like another camera if the spec is designed to allow users to grant access to individual cameras. We could define the integration between the two specifications such that ALS access is granted if access to any camera is granted, since the ALS is likely less directional than a front- or rear-facing camera. Or we could assume that the ALS is always front-facing and tie it to that camera is particular. The rationale for this original proposal was that, on a device with a front-facing camera and ambient light sensor, like a phone or laptop, the information captured by these two sensors is equivalent from a privacy perspective as both measure light coming from roughly the same direction. The ALS is obviously a much lower-detail sensor but rather than explain to the user that the site is requesting something less powerful but still potentially concerning to their privacy we simply call them both a camera and leave it at that. It also helps that applications such as iProov are going to be requesting access to both the ALS and front-facing camera at the same time anyways. |
I wouldn't say that information captured with a front-facing camera and ALS are equivalent (esp. not in context of privacy, as camera also offers, well, the full view), as they are very different. The issue is that if the permission is asked to in order to use ALS, it would then be possible to use it as a camera, which may be unexpected. Unless the prompt would fully inform about access to camera, and all that mechanisms that exist today. |
Yes, my proposal is to fully inform the user about access to the camera. I shouldn't have said that they were equivalent. What I said afterwards is the important part: Trying to explain to the user what an ALS is and how they should think about the privacy consequences is likely too complex. We should treat it as if it were as powerful as a real camera instead. We should call it a camera. Ideally we could bundle it up with all the other cameras in the existing "camera" permission but as @rakuco pointed out, the Media Capture spec supports granting permission to individual cameras. I'm not sure how to resolve that. Does this at least clarify the original rationale for this proposal? |
@reillyeon That does clarify, thanks. I do see the appeal of reusing the camera permission. On the other hand, I'd have thought that As of today, Safari doesn't support the Permissions API at all; in Firefox while If developers want to build a rich, interactive experience on the web platform, queueing prompt after prompt isn't a great user experience. To request motion data and camera on Safari on iOS, you have two separate, blocking prompts that the user needs to click. To make matters worse, the decision to deny permission is cached until you reload the page, which can break SPAS. In my opinion, it's likely that developers are going to be requesting more than one permission for their experiences, so the The permission/privacy/query/request landscape is already quite fragmented, and I'm not sure if shoehorning in ALS permissions through the camera is going to make things better, even if I really, really want to use it in production today(!) I can see parallels being drawn with accelerometer/magnetometer permissions, where Would a more consistent way of doing this be to keep the I feel like that approach at least has buy-in from WebKit and Chrome, with Mozilla's position tbc. Btw, I see that permissions.request() and permissions.revoke() are now back in the WICG 😖 |
Per https://webkit.org/tracking-prevention/ (particularly the "Anti Fingerprinting" section) I wouldn't worry too much about WebKit in this context.
Given WICG/permissions-request#5 and the level of activity in both WICG specs, I don't think these APIs will (re)appear any time soon and would not count on them. @engedy is an editor for both though, so he might have more information about this. |
In addition to that, I feel it's hard to use the "camera" permission in a way that does not either break or weaken the requirements of the Media Capture spec. As mentioned in #79 (comment) I think we'd need to think of the enumerability of ambient light sensors, how they integrate into Media Capture's Privacy Indicator Requirements, the If we were not to use the "camera" permission, I think we'd have to deal with two problems:
Aren't they both user agent concerns more than spec ones though? A UA could choose not to show a prompt, or delay showing it to bundle it with others based on whatever heuristics or data it chooses (1), and a UA could also choose to implement some UI for ALS requests similar to what it shows for media capture (2). Based on the concerns and possible issues with using the "camera" permission, maybe abandoning this idea would lead to less work and confusion? |
@reillyeon @engedy I was wondering if you had time to look at the comments above? |
@reillyeon I see, so you treat ALS as potentially being even more invasive than it may be (i.e. as if a full camera was used), if so then it does clarify the case here |
One extra option that @mikewest mentioned when we talked about this today: experiment with handling it as a camera in the implementation side and, if that makes sense, incorporate the idea into the spec. As such, I'd appreciate some input here too. In other words, since the original idea is requiring the "camera" permission and some of the use cases listed in https://w3c.github.io/ambient-light/#usecases-requirements are already tied to camera use, we could require the "camera" permission without requesting it -- if A few opens:
|
This was discussed at the 2022 TPAC: https://www.w3.org/2022/09/15-dap-minutes.html#t18 The specifics of how this would work have varied over time, so let me try to see if I've captured the latest proposal correctly. The idea is to tie ALS and video capture (via
We'd have an "ALS readings can be exposed" algorithm like this for an AmbientLightSensor object
It's similar to https://w3c.github.io/mediacapture-main/#context-capturing-state, and it would be run whenever the The Media Capture spec is a bit hand-wavy when it comes to the concepts of sources and devices, and I think we'd be the first to have this sort of integration, so I'd like to double check that this is the right direction. Opens:
|
I think we should remove it because it's not something that it would make sense for a developer to request or query the state of.
I think firing an error event with something like "No active video track." would provide a better developer experience.
Same as above.
Just requiring an active video track does seem like it simplifies the model significantly.
I'm not sure that it provides value and just makes the API harder to call. |
Related to w3c/ambient-light#79, where we want to replace the "ambient-light" powerful feature with an integration with the Media Capture and Streams spec by only providing illuminance readouts if the same page has an active local video source. Part of it requires checking the above condition when `Sensor.start()` is called; the new algorithm introduced here does it in the "activate a sensor object" abstract operation. Additionally, `Sensor.start()` is now invoking "activate a sensor object" as a queued task, as we want it to run in the main event loop rather than in parallel since at least the Ambient Light Sensor implementation of the "pre-activation checks algorithm" needs access to the relevant global object and its internal slots.
…set. Related to w3c/ambient-light#79, where we want to replace the "ambient-light" powerful feature with an integration with the Media Capture and Streams spec by only providing illuminance readouts if the same page has an active local video source. In this case, we rely on the Media Capture and Streams' permission model, as having an active local video source implicitly means the "camera" permission has already been granted. Mention the Ambient Light Sensor case and change the requirement for the snesor permissions name set.
Fixes w3c#79. The idea is that, based on the research on potential attacks on the Ambient Light Sensor API, it is important to prompt users before allowing access to illuminance readouts. This was already mandated by the main Generic Sensors spec, as `Sensor.start()` runs the "Request sensor access" abstract operation. The challenge with the Ambient Light Sensor API is prompting users in a way that they understand what they are being prompted for; the assumption is that most users are not familiar with what an Ambient Light sensor is. We have chosen to solve this issue by dropping our "ambient-light-sensor" powerful feature name altogether and integrating with the Media Capture and Streams specification instead: we consider an Ambient Light Sensor to be a 1x1 camera and require there to be at least one local video source that is not muted or stopped in order for illuminance readouts to be provided. Per the Media Capture and Streams specification, this is only possible if script has called `MediaDevices.getUserMedia()` and granted the "camera" permission. This also means the User Agent has at least indicated to the user that a local video source has started being used. In other words, an Ambient Light Sensor only provides readings if a local video source (such as a camera) is currently active and being used in the same window as the AmbientLightSensor instance, and when all local video sources stop we also stop providing readouts and fire an "error" with a NotReadableError exception.
Fixes w3c#79. The idea is that, based on the research on potential attacks on the Ambient Light Sensor API, it is important to prompt users before allowing access to illuminance readouts. This was already mandated by the main Generic Sensors spec, as `Sensor.start()` runs the "Request sensor access" abstract operation. The challenge with the Ambient Light Sensor API is prompting users in a way that they understand what they are being prompted for; the assumption is that most users are not familiar with what an Ambient Light sensor is. We have chosen to solve this issue by dropping our "ambient-light-sensor" powerful feature name altogether and integrating with the Media Capture and Streams specification instead: we consider an Ambient Light Sensor to be a 1x1 camera and require there to be at least one local video source that is not muted or stopped in order for illuminance readouts to be provided. Per the Media Capture and Streams specification, this is only possible if script has called `MediaDevices.getUserMedia()` and granted the "camera" permission. This also means the User Agent has at least indicated to the user that a local video source has started being used. In other words, an Ambient Light Sensor only provides readings if a local video source (such as a camera) is currently active and being used in the same window as the AmbientLightSensor instance, and when all local video sources stop we also stop providing readouts and fire an "error" with a NotReadableError exception.
Fixes w3c#79. The idea is that, based on the research on potential attacks on the Ambient Light Sensor API, it is important to prompt users before allowing access to illuminance readouts. This was already mandated by the main Generic Sensors spec, as `Sensor.start()` runs the "Request sensor access" abstract operation. The challenge with the Ambient Light Sensor API is prompting users in a way that they understand what they are being prompted for; the assumption is that most users are not familiar with what an Ambient Light sensor is. We have chosen to solve this issue by dropping our "ambient-light-sensor" powerful feature name altogether and integrating with the Media Capture and Streams specification instead: we consider an Ambient Light Sensor to be a 1x1 camera and require there to be at least one local video source that is not muted or stopped in order for illuminance readouts to be provided. Per the Media Capture and Streams specification, this is only possible if script has called `MediaDevices.getUserMedia()` and granted the "camera" permission. This also means the User Agent has at least indicated to the user that a local video source has started being used. In other words, an Ambient Light Sensor only provides readings if a local video source (such as a camera) is currently active and being used in the same window as the AmbientLightSensor instance, and when all local video sources stop we also stop providing readouts and fire an "error" with a NotReadableError exception.
Related to w3c/ambient-light#79, where we want to replace the "ambient-light" powerful feature with an integration with the Media Capture and Streams spec by only providing illuminance readouts if the same page has an active local video source. Part of it requires checking the above condition when `Sensor.start()` is called; the new algorithm introduced here does it in the "activate a sensor object" abstract operation. Additionally, `Sensor.start()` is now invoking "activate a sensor object" as a queued task, as we want it to run in the main event loop rather than in parallel since at least the Ambient Light Sensor implementation of the "pre-activation checks algorithm" needs access to the relevant global object and its internal slots.
…set. Related to w3c/ambient-light#79, where we want to replace the "ambient-light" powerful feature with an integration with the Media Capture and Streams spec by only providing illuminance readouts if the same page has an active local video source. In this case, we rely on the Media Capture and Streams' permission model, as having an active local video source implicitly means the "camera" permission has already been granted. Mention the Ambient Light Sensor case and change the requirement for the snesor permissions name set.
Related to w3c/ambient-light#79, where we want to replace the "ambient-light" powerful feature with an integration with the Media Capture and Streams spec by only providing illuminance readouts if the same page has an active local video source. Part of it requires checking the above condition when `Sensor.start()` is called; the new algorithm introduced here does it in the "activate a sensor object" abstract operation. Additionally, `Sensor.start()` is now invoking "activate a sensor object" as a queued task, as we want it to run in the main event loop rather than in parallel since at least the Ambient Light Sensor implementation of the "pre-activation checks algorithm" needs access to the relevant global object and its internal slots.
Related to w3c/ambient-light#79, where we want to replace the "ambient-light" powerful feature with an integration with the Media Capture and Streams spec by only providing illuminance readouts if the same page has an active local video source. In this case, we rely on the Media Capture and Streams' permission model, as having an active local video source implicitly means the "camera" permission has already been granted. Mention the Ambient Light Sensor case and change the requirement for the snesor permissions name set.
Fixes w3c#79. The idea is that, based on the research on potential attacks on the Ambient Light Sensor API, it is important to prompt users before allowing access to illuminance readouts. This was already mandated by the main Generic Sensors spec, as `Sensor.start()` runs the "Request sensor access" abstract operation. The challenge with the Ambient Light Sensor API is prompting users in a way that they understand what they are being prompted for; the assumption is that most users are not familiar with what an Ambient Light sensor is. We have chosen to solve this issue by dropping our "ambient-light-sensor" powerful feature name altogether and integrating with the Media Capture and Streams specification instead: we consider an Ambient Light Sensor to be a 1x1 camera and require there to be at least one local video source that is not muted or stopped in order for illuminance readouts to be provided. Per the Media Capture and Streams specification, this is only possible if script has called `MediaDevices.getUserMedia()` and granted the "camera" permission. This also means the User Agent has at least indicated to the user that a local video source has started being used. In other words, an Ambient Light Sensor only provides readings if a local video source (such as a camera) is currently active and being used in the same window as the AmbientLightSensor instance, and when all local video sources stop we also stop providing readouts and fire an "error" with a NotReadableError exception.
Fixes w3c#79. The idea is that, based on the research on potential attacks on the Ambient Light Sensor API, it is important to prompt users before allowing access to illuminance readouts. This was already mandated by the main Generic Sensors spec, as `Sensor.start()` runs the "Request sensor access" abstract operation. The challenge with the Ambient Light Sensor API is prompting users in a way that they understand what they are being prompted for; the assumption is that most users are not familiar with what an Ambient Light sensor is. We have chosen to solve this issue by dropping our "ambient-light-sensor" powerful feature name altogether and integrating with the Media Capture and Streams specification instead: we consider an Ambient Light Sensor to be a 1x1 camera and require there to be at least one local video source that is not muted or stopped in order for illuminance readouts to be provided. Per the Media Capture and Streams specification, this is only possible if script has called `MediaDevices.getUserMedia()` and granted the "camera" permission. This also means the User Agent has at least indicated to the user that a local video source has started being used. In other words, an Ambient Light Sensor only provides readings if a local video source (such as a camera) is currently active and being used in the same window as the AmbientLightSensor instance, and when all local video sources stop we also stop providing readouts and fire an "error" with a NotReadableError exception. The Use Cases section had to be shortened, as some items described there no longer make much sense when a camera is required.
Fixes w3c#79. The idea is that, based on the research on potential attacks on the Ambient Light Sensor API, it is important to prompt users before allowing access to illuminance readouts. This was already mandated by the main Generic Sensors spec, as `Sensor.start()` runs the "Request sensor access" abstract operation. The challenge with the Ambient Light Sensor API is prompting users in a way that they understand what they are being prompted for; the assumption is that most users are not familiar with what an Ambient Light sensor is. We have chosen to solve this issue by dropping our "ambient-light-sensor" powerful feature name altogether and integrating with the Media Capture and Streams specification instead: we consider an Ambient Light Sensor to be a 1x1 camera and require there to be at least one local video source that is not muted or stopped in order for illuminance readouts to be provided. Per the Media Capture and Streams specification, this is only possible if script has called `MediaDevices.getUserMedia()` and granted the "camera" permission. This also means the User Agent has at least indicated to the user that a local video source has started being used. In other words, an Ambient Light Sensor only provides readings if a local video source (such as a camera) is currently active and being used in the same window as the AmbientLightSensor instance, and when all local video sources stop we also stop providing readouts and fire an "error" with a NotReadableError exception. The Use Cases section had to be shortened, as some items described there no longer make much sense when a camera is required.
See https://www.w3.org/2021/10/29-dap-minutes.html#t07:
If I've understood it correctly, the idea would be to add text to the spec that mandates that permission for accessing ALS would be granted only if access to ALS as well as camera is allowed (in a similar fashion to
getUserMedia()
and the microphone/camera permissions, for example).I'd like to make sure that this is indeed the idea, especially in light of #64 (comment) (This will require continuous monitoring of the ALS and not make sense to bundle with a camera API (including permissions)).
I'm also wondering if this makes sense as a normative requirement or as an implementation detail. The DAS F2F discussion mentioned Chrome's position:
in this case, isn't it up to the UA to do one of the following:
AmbientLightSensor.start()
if access to the camera has not been granted beforeThe text was updated successfully, but these errors were encountered: