1
0
Fork 0
mutter-performance-source/src/core
Sergio Costas f894f5cc13 wayland: Add API to launch trusted clients
Allowing code from inside mutter to create a child process and
delegate on it some of its tasks is something very useful. This can
be done easily with the g_subprocess and g_subprocess_launcher classes
already available in GLib and GObject.

Unfortunately, although the child process can be a graphical program,
currently it is not possible for the inner code to identify the
windows created by the child in a secure manner (this is: being able
to ensure that a malicious program won't be able to trick the inner
code into thinking it is a child process launched by it).

Under X11 this is not a problem because any program has full control
over their windows, but under Wayland it is a different story: a
program can't neither force their window to be kept at the top (like a
docker program does) or at the bottom (like a program for desktop icons
does), nor hide it from the list of windows. This means that it is not
possible for a "classic", non-priviledged program, to fulfill these
tasks, and it can be done only from code inside mutter (like a
gnome-shell extension).

This is a non desirable situation, because an extension runs in the
same main loop than the whole desktop itself, which means that a
complex extension can need to do too much work inside the main loop,
and freeze the whole desktop for too much time. Also, it is important
to note that javascript doesn't have access to fork(), or threads,
which means that, at most, all the parallel computing that can do is
those available in the _async calls in GLib/GObject.

Also, having to create an extension for any priviledged graphical
element is an stopper for a lot of programmers who already know
GTK+ but doesn't know Clutter.

This patch wants to offer a solution to this problem, by offering a
new class that allows to launch a trusted child process from inside
mutter, and make it to use an specific UNIX socket to communicate
with the compositor. It also allows to check whether an specific
MetaWindow was created by one of this trusted child processes or not.

This allows to create extensions that launch a child process, and
when that process creates a window, the extension can confirm in a
secure way that the window really belongs to that process
launched by it, so it can give to that window "superpowers" like
being kept at the bottom of the desktop, not being listed in the
list of windows or shown in the Activities panel... Also, in future
versions, it could easily implement protocol extensions that only
could be used by these trusted child processes.

Several examples of the usefulness of this are that, with it, it
is possible to write programs that implements:

- desktop icons
- a dock
- a top or bottom bar
...

all in a secure manner, avoiding insecure programs to do the same.
In fact, even if the same code is launched manually, it won't have
those privileges, only the specific process launched from inside
mutter.

Since this is only needed under Wayland, it won't work under X11.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/741
2020-08-04 08:42:29 +00:00
..
bell.c frame: Remove flashing support 2019-03-12 00:27:07 +00:00
bell.h frame: Remove flashing support 2019-03-12 00:27:07 +00:00
boxes-private.h Add MetaGravity and replace X11 equivalent with it 2020-02-29 21:01:50 +00:00
boxes.c Add MetaGravity and replace X11 equivalent with it 2020-02-29 21:01:50 +00:00
constraints.c cleanup: Remove duplicate semicolons in C code 2020-07-28 10:32:46 +02:00
constraints.h window: Implement asynchronous popup moving 2020-02-29 21:01:50 +00:00
delete.c window: Use client PID for meta_window_get_pid() 2020-05-21 23:10:23 +00:00
display-private.h Add MetaGravity and replace X11 equivalent with it 2020-02-29 21:01:50 +00:00
display.c compositor: Get the stage via the backend 2020-06-05 21:39:27 +00:00
edge-resistance.c Add MetaGravity and replace X11 equivalent with it 2020-02-29 21:01:50 +00:00
edge-resistance.h Add MetaGravity and replace X11 equivalent with it 2020-02-29 21:01:50 +00:00
events.c core: Let pad mode switch events always go through MetaInputSettings 2020-03-25 19:56:09 +01:00
events.h Clean up include macros mess 2018-11-06 17:17:36 +01:00
frame.c frame: Pass the frame area for get_mask() 2020-01-29 10:44:50 +00:00
frame.h frame: Pass the frame area for get_mask() 2020-01-29 10:44:50 +00:00
keybindings-private.h keybindings: Do not grab the locate-pointer key if unnecessary 2019-07-18 13:10:32 +00:00
keybindings.c compositor: use XDG_CONFIG_HOME as initial lookup path for xkb 2020-06-08 11:29:30 +00:00
main-private.h meta: Move private defines to a private header 2019-10-15 11:03:56 +00:00
main.c Reshuffle Wayland initailization 2020-05-26 16:35:00 +02:00
meta-accel-parse.c Clean up include macros mess 2018-11-06 17:17:36 +01:00
meta-accel-parse.h Clean up include macros mess 2018-11-06 17:17:36 +01:00
meta-anonymous-file.c Add read-only anonymous file abstraction MetaAnonymousFile 2020-04-21 17:52:08 +02:00
meta-anonymous-file.h Add read-only anonymous file abstraction MetaAnonymousFile 2020-04-21 17:52:08 +02:00
meta-border.c MetaBorder: Use float constants and functions instead of double variants 2016-02-16 19:02:48 +08:00
meta-border.h Move out generic math parts out of the native barrier implementation 2016-02-16 19:02:48 +08:00
meta-clipboard-manager.c core: Free clipboard selection source on shutdown 2020-06-08 12:11:11 +00:00
meta-clipboard-manager.h core: Add clipboard manager 2019-05-02 16:22:45 +02:00
meta-close-dialog-default-private.h Clean up include macros mess 2018-11-06 17:17:36 +01:00
meta-close-dialog-default.c cleanup: Use g_clear_handle_id() for g_source_remove() 2019-11-22 01:27:40 +01:00
meta-close-dialog.c Use a consistent style for enum braces 2019-02-28 09:31:01 +01:00
meta-fraction.c Add MetaFraction for dealing with fractions 2017-08-29 14:39:04 +08:00
meta-fraction.h Add MetaFraction for dealing with fractions 2017-08-29 14:39:04 +08:00
meta-gesture-tracker-private.h display: Move finishing of touch sequence to the backend 2019-10-28 18:40:43 +00:00
meta-gesture-tracker.c cleanup: Use g_clear_handle_id() for g_source_remove() 2019-11-22 01:27:40 +01:00
meta-inhibit-shortcuts-dialog-default-private.h Clean up include macros mess 2018-11-06 17:17:36 +01:00
meta-inhibit-shortcuts-dialog-default.c Use a consistent style for enum braces 2019-02-28 09:31:01 +01:00
meta-inhibit-shortcuts-dialog.c core: add MetaInhibitShortcutsDialog 2017-08-02 11:58:55 +02:00
meta-launch-context.c core: Use DISPLAY envvar to forward in the launch context 2020-02-29 20:41:26 +00:00
meta-selection-private.h core: Add private function to get the current selection owner 2020-04-09 21:30:05 +00:00
meta-selection-source-memory.c core: Fix task leak in meta_selection_source_memory_read_async 2020-02-01 14:02:19 +00:00
meta-selection-source.c Make MetaSelection, MetaSelectionSource and MetaMemorySelectionSource public 2019-05-02 16:31:45 +02:00
meta-selection.c core: Cater for reading selection in chunks 2020-04-16 16:26:04 +00:00
meta-sound-player.c cleanup: remove controversial naming 2020-08-04 10:04:16 +02:00
meta-workspace-manager-private.h Move workspace related code from MetaDisplay to MetaWorkspaceManager 2018-07-06 19:47:17 +02:00
meta-workspace-manager.c workspace-manager: get_workspace_by_index can return NULL 2019-11-22 22:13:35 +00:00
mutter.c plugin: Rename the .so file from plugin.so to libplugin.so 2018-11-06 17:17:36 +01:00
place.c core/place: Use work area when centering new window. 2020-05-09 09:47:42 +00:00
place.h place: Make placement rule processing provide relative coordinates 2020-02-29 21:01:50 +00:00
prefs.c display: Make check-alive timeout configureable 2020-02-23 17:28:57 +00:00
restart-helper.c Clean up include macros mess 2018-11-06 17:17:36 +01:00
restart.c Clean up include macros mess 2018-11-06 17:17:36 +01:00
stack-tracker.c stack-tracker: Don't log warnings on race conditions 2020-06-09 18:46:38 +00:00
stack-tracker.h meta: Hide libmutter symbols by default and selectively export them 2019-01-23 14:18:13 +01:00
stack.c cogl: Install cogl-trace.h and include from cogl.h 2020-03-26 09:05:38 +01:00
stack.h stack: Style and introspection doc fixes 2019-07-08 11:46:52 +02:00
startup-notification-private.h meta, startup-notification: Make type declarations public 2019-01-24 16:38:09 +00:00
startup-notification.c cleanup: Use g_clear_handle_id() for g_source_remove() 2019-11-22 01:27:40 +01:00
util-private.h meta: Hide libmutter symbols by default and selectively export them 2019-01-23 14:18:13 +01:00
util.c util: Move MetaLater to its own file 2020-04-16 15:05:52 +02:00
window-private.h wayland: Add API to launch trusted clients 2020-08-04 08:42:29 +00:00
window.c wayland: Add API to launch trusted clients 2020-08-04 08:42:29 +00:00
workspace-private.h Clean up include macros mess 2018-11-06 17:17:36 +01:00
workspace.c workspace: Add :active convenience property 2020-06-29 14:07:20 +00:00