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

Camera: use an empty app id in access dialog in case of empty app info #1512

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

grulja
Copy link
Contributor

@grulja grulja commented Nov 12, 2024

Sending an app id that doesn't resolve to valid app info (e.g. a desktop file is not found) will automatically reject camera request, because the backend is not able to verify whether the app (based on app id) runs in the background. This happens for example when you start Firefox in GNOME using Alt + F2 shortcut, where we get firefox" as app id from cgroups and since it doesn't find opened application window for "firefox", it automatically rejects the request. Using an empty id fixes this problem.

@grulja grulja requested a review from jadahl November 12, 2024 09:32
src/camera.c Outdated Show resolved Hide resolved
@grulja grulja changed the title Camera: use an empty app id in access dialog in case of empty app info Camera: use an empty app id in access dialog in case of invalid app id Nov 12, 2024
src/camera.c Outdated Show resolved Hide resolved
@grulja grulja changed the title Camera: use an empty app id in access dialog in case of invalid app id Camera: use an empty app id in access dialog in case of empty app info Nov 12, 2024
src/camera.c Outdated Show resolved Hide resolved
Copy link
Contributor

@swick swick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current version looks good to me

src/camera.c Outdated Show resolved Hide resolved
src/camera.c Outdated Show resolved Hide resolved
@grulja
Copy link
Contributor Author

grulja commented Nov 12, 2024

@jadahl any final word? If no, can you merge it? I seem to have power to do it myself, but probably shouldn't as I'm not a maintainer here :)

@jadahl
Copy link
Collaborator

jadahl commented Nov 12, 2024

Since this changes policy about how to deal with permissions (even though only for non-sandboxed apps), I think we should let it sit here for a few days. If no objections, then it can land.

Sending an app id that doesn't resolve to valid app info (e.g. a desktop
file is not found) will automatically reject camera request, because the
backend is not able to verify whether the app (based on app id) runs in
the background. This happens for example when you start Firefox in GNOME
using Alt + F2 shortcut, where we get firefox" as app id from cgroups
and since it doesn't find opened application window for "firefox", it
automatically rejects the request. Using an empty id fixes this problem.
@A6GibKm
Copy link
Contributor

A6GibKm commented Nov 20, 2024

Would it make sense to add a app-id option to the options in AccessCamera?

@swick
Copy link
Contributor

swick commented Nov 20, 2024

If we want to provide a way for apps to specify their app id (only when the app id cannot be inferred) then it probably makes sense to add a new interface just for that to avoid having to add it to every portal.

IOW, I think this is out of scope here.

@jadahl
Copy link
Collaborator

jadahl commented Nov 20, 2024

Indeed out of scope, right now, the app id is always inferred and never explicitly set by apps.

@A6GibKm
Copy link
Contributor

A6GibKm commented Nov 20, 2024

Would a window handle improve the situation compared to an app-id? Anyways, yeah this is out of scope.

This MR looks good to me, but I missed an explanation of why the empty string fixes the issue.

@jadahl
Copy link
Collaborator

jadahl commented Nov 20, 2024

Would a window handle improve the situation compared to an app-id? Anyways, yeah this is out of scope.

Window handles are always about window management stacking order, i.e. placing a dialog on top of another window, which isn't needed here.

This MR looks good to me, but I missed an explanation of why the empty string fixes the issue.

It's to handle cases where one e.g. runs some app from a terminal and gets an cgroup that resolves to some bogus "app id". Detecting that and falling back to "" means the portal backend can handle it as "this is an unidentifiable app".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs Triage
Development

Successfully merging this pull request may close these issues.

4 participants