Skip to content
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

getUserMedia can be used to detect capabilities without permissions #697

Closed
guidou opened this issue Jun 16, 2020 · 10 comments
Closed

getUserMedia can be used to detect capabilities without permissions #697

guidou opened this issue Jun 16, 2020 · 10 comments
Labels
privacy-tracker Group bringing to attention of Privacy, or tracked by the Privacy Group but not needing response.

Comments

@guidou
Copy link
Contributor

guidou commented Jun 16, 2020

The current getUserMedia() spec indicates that prompting for permission (step 5.2) goes after constraints processing (step 3.4).
A consequence of this is that it is possible to determine if the system is capable of, for example full HD capture (or any other capability), by making the appropriate gUM calls and looking at the resulting error.
In these cases, Chromium and Safari return OverconstrainedError and Firefox returns NotFoundError.

Possible ways to address this:

  1. Always return NotAllowedError if constraints processing fails, but no permission to use devices has yet been granted.
  2. Prompt before constraints processing.

Should we update the spec to address this?

@dontcallmedom dontcallmedom added the privacy-tracker Group bringing to attention of Privacy, or tracked by the Privacy Group but not needing response. label Jun 16, 2020
@alvestrand
Copy link
Contributor

Step 6.3.4 of the getUserMedia algorithm is already marked with a fingerprint marker; this has been discussed before, and the decision at the time was to warn the implementors, not change the processing.

The uncomfortable interaction if you swap the two is to get a permissions prompt, grant permission, and then get a "ha ha, you can't do this anyway" error message because you have no device that can satisfy the constraint.

My suggestion: This can be revisited in @jan-ivar's proposed extension spec for a getUserMedia variant that mandates an in-chrome picker. In the meantime, I wouldn't want to change present behavior.

@youennf
Copy link
Contributor

youennf commented Jun 18, 2020

In addition to what Harald said, the fingerprinting script would take the risk to show a prompt to the user, which is probably too risky for the script. To ensure this is annoying enough for such scripts, we make sure that:

  • The processing of getUserMedia can only happen in a visible page (so that the prompt can be shown), step 6.1. Processing is delayed for hidden pages until they are visible.
  • The error message should not provide any info on which constraint was not met if device info cannot be exposed. It seems we did this in step 6.6 but forgot to do it in step 6.4. We should probably fix this.

AFAIUI, OverconstrainedError is what should be returned according the spec.
Is it a Firefox bug?

@youennf
Copy link
Contributor

youennf commented Jun 18, 2020

Another possibility is to progressively move out of mandatory constraints but treat them as ideal, except for some specific constraints like deviceId.

@jan-ivar
Copy link
Member

Firefox returns NotFoundError.

@guidou please provide repro steps. Firefox returns OverconstrainedError for me.

If you're on mac, make sure you've granted OS camera permission to Firefox. That might explain the NotFoundError.

@jan-ivar
Copy link
Member

jan-ivar commented Jun 18, 2020

We've discussed this in the past, and we decided trackers would not risk a prompt.

In the spec, we neutered the error.contraint property ahead of permission to mitigate the attack where multiple failing constraints are used: "Run the ApplyConstraints algorithm on all tracks in stream with the appropriate constraints. Should this fail, let failedConstraint be the result of the algorithm that failed if device information can be exposed is true, or undefined otherwise"

@guidou
Copy link
Contributor Author

guidou commented Jun 18, 2020

You're right @jan-ivar . That was the reason. After giving system permission on Mac I get OverconstrainedError.

@youennf
Copy link
Contributor

youennf commented Jul 23, 2020

As discussed in w3c/mediacapture-image#229 (comment), it might be good to restrict the potential constraints that can be used as required in getUserMedia.
This would be specific to getUserMedia and would not apply to applyConstraints.

@youennf
Copy link
Contributor

youennf commented Jul 23, 2020

Initial PR at #707.
Ideally we would reduce the number of allowed mandatory constraints.

@alvestrand
Copy link
Contributor

I don't see a sufficiently clear case that the (admittedly minor) privacy leak is important enough that we should remove or limit the ability to not get devices you can't use for your purposes. We need a WG consensus to set a direction here.

@alvestrand
Copy link
Contributor

Closed as a result of merging #707.

@jan-ivar jan-ivar closed this as completed Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
privacy-tracker Group bringing to attention of Privacy, or tracked by the Privacy Group but not needing response.
Projects
None yet
Development

No branches or pull requests

5 participants