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

GUI-related feature flags not validated #7730

Closed
DemiMarie opened this issue Sep 1, 2022 · 9 comments · Fixed by QubesOS/qubes-core-admin-client#315
Closed

GUI-related feature flags not validated #7730

DemiMarie opened this issue Sep 1, 2022 · 9 comments · Fixed by QubesOS/qubes-core-admin-client#315
Assignees
Labels
affects-4.1 This issue affects Qubes OS 4.1. C: core diagnosed Technical diagnosis has been performed (see issue comments). P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. pr submitted A pull request has been submitted for this issue. T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists.

Comments

@DemiMarie
Copy link

How to file a helpful issue

Qubes OS release

R4.1

Brief summary

Various GUI-related features are not validated by qubesd. Once QubesOS/qubes-core-admin-client#221 lands, this will cause qvm-start-daemon to produce an invalid GUI daemon configuration file, preventing the GUI daemon from starting.

Steps to reproduce

Have QubesOS/qubes-core-admin-client#221 and set gui-subwindows feature to something invalid.

Expected behavior

Feature set call is rejected by qubesd. Attempts to set unknown gui-* features should likely be rejected unconditionally, as these could acquire a meaning in the future.

Actual behavior

Feature set call is not rejected by qubesd.

@DemiMarie DemiMarie added T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists. P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. labels Sep 1, 2022
@andrewdavidwong andrewdavidwong added C: core needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. labels Sep 2, 2022
@andrewdavidwong andrewdavidwong added this to the Release 4.1 updates milestone Sep 2, 2022
@GWeck
Copy link

GWeck commented Sep 2, 2022

Even documented gui-* features are handled inconsistently:

  • While setting allow_utf8_titles via the Qube Manager to one of the values allowed, disallowed or use system default behaves as expected and sets the value of the corresponding feature gui-allow-utf8-titles accordingly, the value of the corresponding global feature gui-default-allow-utf8-titles, as shown in the qvm-features command, does not change when the global property is changed via the Qube Manager. The value used is that of the Qube Manager and not the value shown in the qvm-features command.

  • It is unclear how to set global defaults from the CLI: The qvm-feautures command requires a VMname parameter, which makes no sense for a global feature.

  • It is possible to create meaningless gui-* features, like allow_utf8_titles which cannot be removed; the --unset command just clears them but does not remove them.

All very confusing.

@marmarek
Copy link
Member

marmarek commented Sep 2, 2022

Documentation says "To change a given GUI option globally, set the gui-default-{option} feature on the GuiVM for that qube." - if your GuiVM is dom0 (the default) then gui-default-* needs to be set on dom0.

@GWeck
Copy link

GWeck commented Sep 2, 2022

This makes it clear: gui-default-allow-utf8-titles should have been set not for <VMname>, but for dom0, or possibly sys-gui or sys-gui-gpu. But then this would apply to all qubes using that GuiVM, not just that qube, as stated in the documentation of qvm-features. I checked, and it works as expected, and I updated the documentation accordingly (see pull request #207 Thank you for this clarification!

The confusion about this behavior could perhaps be reduced by

  • rejecting any attempt to set a gui-default-* option on any non-GuiVM with an appropriate error message;

  • allowing to completely remove meaningless features via the qvm-features --unset command.

@andrewdavidwong andrewdavidwong removed the needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. label Sep 3, 2022
@marmarek
Copy link
Member

marmarek commented Sep 7, 2022

  • the --unset command just clears them but does not remove them.

Can you clarify? What exact command you tried and what was the result?

@GWeck
Copy link

GWeck commented Sep 7, 2022

I repeated the tests now, and qvm-features --unset now removed the meaningless parameters, like it should. Probably the earlier tests brought something into an inconsistent state causing the command to fail. So I suppose that there is nothing to do in this respect. Sorry for the inconvenience!

Still it would be nice if any attempt to set a gui-default-* option for a non-GuiVM would cause some meaningfull warning.

@alimirjamali
Copy link

Various GUI-related features are not validated by qubesd.

This appears to be easy to solve. The current GUI_DAEMON_OPTIONS is a list of tuples (feature, type). And type could be changed to lambda validation functions to be used in retrieve_gui_daemon_options function. I will work on it.

@andrewdavidwong andrewdavidwong added the diagnosed Technical diagnosis has been performed (see issue comments). label Oct 30, 2024
alimirjamali added a commit to alimirjamali/qubes-core-admin-client that referenced this issue Oct 30, 2024
@alimirjamali
Copy link

alimirjamali commented Oct 30, 2024

User-end validation (within qvm-start-daemon) is done. It skips invalid values and logs an error messages. Also sends a visual notification via notify-send.

Now the same logic could be applied to qubesd to forbid users from setting invalid values for recognized features and setting unknown gui-* and default-gui-* features (but is it really necessary with the above patch?)

There are some concerns. Specific libraries are required for validating (clipboard) key sequences and valid window_background_color values. Using them within qubes-core-admin-client should be OK (hopefully). Depending qubesd on them is something else.

alimirjamali added a commit to alimirjamali/qubes-core-admin-client that referenced this issue Oct 30, 2024
alimirjamali added a commit to alimirjamali/qubes-core-admin-client that referenced this issue Oct 30, 2024
alimirjamali added a commit to alimirjamali/qubes-core-admin-client that referenced this issue Oct 30, 2024
alimirjamali added a commit to alimirjamali/qubes-core-admin-client that referenced this issue Nov 2, 2024
alimirjamali added a commit to alimirjamali/qubes-core-admin-client that referenced this issue Nov 3, 2024
alimirjamali added a commit to alimirjamali/qubes-core-admin-client that referenced this issue Nov 3, 2024
alimirjamali added a commit to alimirjamali/qubes-core-admin-client that referenced this issue Nov 3, 2024
alimirjamali added a commit to alimirjamali/qubes-core-admin-client that referenced this issue Nov 3, 2024
alimirjamali added a commit to alimirjamali/qubes-core-admin-client that referenced this issue Nov 3, 2024
alimirjamali added a commit to alimirjamali/qubes-core-admin-client that referenced this issue Nov 3, 2024
alimirjamali added a commit to alimirjamali/qubes-core-admin-client that referenced this issue Nov 3, 2024
alimirjamali added a commit to alimirjamali/qubes-core-admin-client that referenced this issue Nov 3, 2024
alimirjamali added a commit to alimirjamali/qubes-core-admin-client that referenced this issue Nov 4, 2024
alimirjamali added a commit to alimirjamali/qubes-core-admin-client that referenced this issue Nov 5, 2024
@alimirjamali
Copy link

The PR for this issue (including unittests) is done. All CI/CD checks are green

Review priority: low

Notes: Color and keyboard sequence verification is done via direct connection to X Display via python-xlib library. Invalid features will be ignored and user will receive a warning notification (picture below). If the validation is moved from GUIVM to qubesd to validate features at setting time, dom0 should always have access to a display server. And I wonder if valid colors/keys are the same between different versions of XServer and XWayland. Overall this is a major decision for senior developers.

gui-validation

@marmarek
Copy link
Member

Since the change is has noticeable regression potential, I'm not going to backport it to R4.2, at least not yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.1 This issue affects Qubes OS 4.1. C: core diagnosed Technical diagnosis has been performed (see issue comments). P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. pr submitted A pull request has been submitted for this issue. T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants