-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
camera: fix permission check in OpenPipeWireRemote #1572
camera: fix permission check in OpenPipeWireRemote #1572
Conversation
6cd99b0 changed the logic that the camera portal uses to look up permissions for the AccessCamera method. Applications first call AccessCamera to ensure they have camera permission and to prompt the user if permission is missing, then they call OpenPipeWireRemote, which fails if permission is missing. The permission lookup logic needs to be the same in both places. Currently when running Snapshot launched by GNOME Shell (rather than launched in a terminal), Snapshot passes AccessCamera's permission check, then fails OpenPipeWireRemote's permission check, causing camera access to be denied without allowing the user to grant permission. Also, since the same commit the code uses the XdpAppInfo on a secondary thread. I suspect this is unsafe, and the original code avoided doing so; therefore, let's be careful and move this logic to the main thread so that the secondary thread only receives a copy of the app ID, as before. https://gitlab.gnome.org/GNOME/snapshot/-/issues/267
@grulja mentioned in the Snapshot issue:
Hi maintainers, do we really need the g_object_set_data()/g_object_get_data()? It has been there since the camera portal was first introduced by @jadahl. Then I guess the lock is just in the wrong place and should also be fixed. I can do that in this pull request if you prefer. |
I don't know why it has been done like that and I'm certainly not a glib expect so most of the API is a stranger to me, but this xdg-desktop-portal/src/account.c Line 103 in 7928c83
Anyway, it looks good to me, with the suggestion to hold the lock around |
Discussed with Georges on Matrix:
|
This broke test-camera, so I'll remove this change. |
ec9ccc1
to
05b1e4f
Compare
6cd99b0 changed the logic that the camera portal uses to look up permissions for the AccessCamera method. Applications first call AccessCamera to ensure they have camera permission and to prompt the user if permission is missing, then they call OpenPipeWireRemote, which fails if permission is missing. The permission lookup logic needs to be the same in both places. Currently when running Snapshot launched by GNOME Shell (rather than launched in a terminal), Snapshot passes AccessCamera's permission check, then fails OpenPipeWireRemote's permission check, causing camera access to be denied without allowing the user to grant permission.
Also, since the same commit the code uses the XdpAppInfo on a secondary thread. I suspect this is unsafe, and the original code avoided doing so; therefore, let's be careful and move this logic to the main thread so that the secondary thread only receives a copy of the app ID, as before.
https://gitlab.gnome.org/GNOME/snapshot/-/issues/267