mutter/src/meta
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
..
barrier.h Use a consistent style for enum braces 2019-02-28 09:31:01 +01:00
boxes.h meta: Hide libmutter symbols by default and selectively export them 2019-01-23 14:18:13 +01:00
common.h backend/xcursor: Support a "blank" cursor type 2020-05-22 14:10:50 +00:00
compositor-mutter.h compositor/x11: Move stage input region setting to MetaX11Display 2019-08-19 08:44:58 +00:00
compositor.h compositor: Let MetaDisplay choose the correct compositor type 2019-08-19 08:44:58 +00:00
display.h core: Untangle input focus management 2019-05-24 15:30:31 +00:00
group.h meta: Hide libmutter symbols by default and selectively export them 2019-01-23 14:18:13 +01:00
keybindings.h meta: Hide libmutter symbols by default and selectively export them 2019-01-23 14:18:13 +01:00
main.h main: Add test initialization function 2019-08-27 16:34:01 +00:00
meson.build wayland: Add API to launch trusted clients 2020-08-04 08:42:29 +00:00
meta-backend.h renderer: Add API to check whether renderer is hardware accelerated 2020-02-20 10:40:42 +00:00
meta-background-actor.h Include the pkgconfig-specified gdesktop-enums.h 2020-07-13 17:30:20 +08:00
meta-background-content.h Include the pkgconfig-specified gdesktop-enums.h 2020-07-13 17:30:20 +08:00
meta-background-group.h meta: Make MetaBackgroundGroup derivable 2019-06-24 13:49:31 +00:00
meta-background-image.h meta: Hide libmutter symbols by default and selectively export them 2019-01-23 14:18:13 +01:00
meta-background.h Include the pkgconfig-specified gdesktop-enums.h 2020-07-13 17:30:20 +08:00
meta-close-dialog.h meta: Hide libmutter symbols by default and selectively export them 2019-01-23 14:18:13 +01:00
meta-cursor-tracker.h cursor-tracker: Add API to get whether the pointer is visible 2019-07-10 12:39:06 +00:00
meta-dnd.h meta: Hide libmutter symbols by default and selectively export them 2019-01-23 14:18:13 +01:00
meta-enum-types.c.in Move meta-enum-type.*.in into meta/ 2018-11-06 17:17:36 +01:00
meta-enum-types.h.in enum-types: Use @basename@ in header comment 2019-06-12 18:01:36 +02:00
meta-idle-monitor.h backends: Drop meta_idle_monitor_get_for_device() 2020-02-12 22:07:55 +00:00
meta-inhibit-shortcuts-dialog.h meta: Hide libmutter symbols by default and selectively export them 2019-01-23 14:18:13 +01:00
meta-later.h later: Make MetaCompositor the owner of the MetaLaters state 2020-04-16 15:05:52 +02:00
meta-launch-context.h meta: Hide libmutter symbols by default and selectively export them 2019-01-23 14:18:13 +01:00
meta-monitor-manager.h meta: Hide libmutter symbols by default and selectively export them 2019-01-23 14:18:13 +01:00
meta-plugin.h compositor: Add "locate_pointer" vmethod 2019-06-05 09:34:39 +00:00
meta-remote-access-controller.h remote-access-controller: Allow inhibiting remote access 2020-04-27 14:31:06 +00:00
meta-selection-source-memory.h Make MetaSelection, MetaSelectionSource and MetaMemorySelectionSource public 2019-05-02 16:31:45 +02:00
meta-selection-source.h Make MetaSelection, MetaSelectionSource and MetaMemorySelectionSource public 2019-05-02 16:31:45 +02:00
meta-selection.h Make MetaSelection, MetaSelectionSource and MetaMemorySelectionSource public 2019-05-02 16:31:45 +02:00
meta-settings.h meta: Hide libmutter symbols by default and selectively export them 2019-01-23 14:18:13 +01:00
meta-shadow-factory.h meta: Hide libmutter symbols by default and selectively export them 2019-01-23 14:18:13 +01:00
meta-shaped-texture.h shaped-texture: Make set_opaque_region() private 2020-06-29 12:57:55 +02:00
meta-sound-player.h meta: Hide libmutter symbols by default and selectively export them 2019-01-23 14:18:13 +01:00
meta-stage.h meta: Hide libmutter symbols by default and selectively export them 2019-01-23 14:18:13 +01:00
meta-startup-notification.h meta, startup-notification: Make type declarations public 2019-01-24 16:38:09 +00:00
meta-version.h.in meta: Add generated meta-version.h 2014-06-05 14:05:16 +02:00
meta-wayland-client.h wayland: Add API to launch trusted clients 2020-08-04 08:42:29 +00:00
meta-window-actor.h window-actor: Make freezing and thawing of actor updates public API 2020-06-15 13:10:16 +00:00
meta-window-group.h meta: Hide libmutter symbols by default and selectively export them 2019-01-23 14:18:13 +01:00
meta-window-shape.h meta: Hide libmutter symbols by default and selectively export them 2019-01-23 14:18:13 +01:00
meta-workspace-manager.h meta: Add missing display.h to meta-workspace-manager.h 2020-01-29 11:30:24 +01:00
meta-x11-display.h compositor/x11: Move stage input region setting to MetaX11Display 2019-08-19 08:44:58 +00:00
meta-x11-errors.h meta: Hide libmutter symbols by default and selectively export them 2019-01-23 14:18:13 +01:00
prefs.h display: Make check-alive timeout configureable 2020-02-23 17:28:57 +00:00
theme.h meta: Hide libmutter symbols by default and selectively export them 2019-01-23 14:18:13 +01:00
types.h Make MetaSelection, MetaSelectionSource and MetaMemorySelectionSource public 2019-05-02 16:31:45 +02:00
util.h later: Make MetaCompositor the owner of the MetaLaters state 2020-04-16 15:05:52 +02:00
window.h window: Return pid_t in meta_window_get_pid() 2020-05-21 23:10:23 +00:00
workspace.h meta: Hide libmutter symbols by default and selectively export them 2019-01-23 14:18:13 +01:00