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

context: Added fallback devices #5708

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hfiguiere
Copy link
Collaborator

This provide compatibility to disable all devices when there is new device option

Fixes #5681

  • Need to sort out the documentation
  • Validate with flatpak-builder

Copy link
Collaborator

@smcv smcv left a comment

Choose a reason for hiding this comment

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

(Not a thorough implementation review, I've only had a quick glance at this for now.)

I still think it's not going to be obvious to users what --device=input,all means, and a lot of people will think it's a synonym for --device=input --device=all. It's definitely not obvious what --device=all,input means.

input|all would be a bit clearer, but would have to be quoted by shell users: --device='input|all'. So that's probably not great either.

Maybe --device=input:or-fallback or --device=input:fallback? Or --device=fallback:input,all as I suggested before? Or something along those lines?

I don't think we necessarily want the syntax for this to come with an implicit assumption that the fallback will always be to exactly all - that seems like a choice that we're likely to be regretting in 5 years' time. But perhaps I'm overthinking that part.

On an unrelated point, we have logic elsewhere in Flatpak that decides whether a permissions change is making the app more privileged (which requires prompting the user) or less privileged (which does not). At the moment, that logic has a special case that says --socket=fallback-x11 or --socket=fallback-x11 --socket=x11 is less privileged than --socket=x11, despite what the syntax would normally indicate. Does it need a similar special case that says --device=(anything) --device=all is less privileged than --device=all, or is all already handled specially there?

tests/test-exports.c Outdated Show resolved Hide resolved
common/flatpak-context.c Outdated Show resolved Hide resolved
@hfiguiere hfiguiere force-pushed the device-compat branch 6 times, most recently from 7058539 to eb529fe Compare March 4, 2024 00:56
This provide compatibility to disable all devices when there is new
device option.
A fallback device is specified like `fallback:input,all`. This mean
that if it knows about `input` this indicate that `all` as a separate
device will be removed to narrow down the permissions.

Fixes flatpak#5681

Signed-off-by: Hubert Figuière <[email protected]>
events. This is not necessary for mouse a keyboard input, but it is
for direct device access or game controllers.

`all` exposes everyting. Accept `shm`.

Choose a reason for hiding this comment

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

"Except"

@hfiguiere
Copy link
Collaborator Author

Maybe --device=input:or-fallback or --device=input:fallback? Or --device=fallback:input,all as I suggested before? Or something along those lines?

I went for fallback:. Indeed while more verbose it seems that it will be less confusing.

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

Successfully merging this pull request may close these issues.

Device permission compatibility
3 participants