|
|
72a0dc |
From eb26ea5e1bb0c6fc978aae5db99ed3427b34175b Mon Sep 17 00:00:00 2001
|
|
|
72a0dc |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
72a0dc |
Date: Fri, 1 Apr 2022 19:40:31 +0200
|
|
|
72a0dc |
Subject: [PATCH 01/12] shell/global: Expose shim context property
|
|
|
72a0dc |
|
|
|
72a0dc |
Parts of the following commits rely on the ShellGlobal:context
|
|
|
72a0dc |
property that was added in GNOME 41 to expose the MetaContext
|
|
|
72a0dc |
(likewise a GNOME 41 addition).
|
|
|
72a0dc |
|
|
|
72a0dc |
To prepare for that, expose a small shim object as context
|
|
|
72a0dc |
property that mimicks the expected upstream API.
|
|
|
72a0dc |
---
|
|
|
72a0dc |
src/shell-global.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
72a0dc |
1 file changed, 92 insertions(+)
|
|
|
72a0dc |
|
|
|
72a0dc |
diff --git a/src/shell-global.c b/src/shell-global.c
|
|
|
72a0dc |
index 24e771f52..805c73145 100644
|
|
|
72a0dc |
--- a/src/shell-global.c
|
|
|
72a0dc |
+++ b/src/shell-global.c
|
|
|
72a0dc |
@@ -47,6 +47,9 @@
|
|
|
72a0dc |
|
|
|
72a0dc |
static ShellGlobal *the_object = NULL;
|
|
|
72a0dc |
|
|
|
72a0dc |
+#define SHIM_TYPE_META_CONTEXT shim_meta_context_get_type ()
|
|
|
72a0dc |
+G_DECLARE_FINAL_TYPE (ShimMetaContext, shim_meta_context, SHIM, META_CONTEXT, GObject)
|
|
|
72a0dc |
+
|
|
|
72a0dc |
struct _ShellGlobal {
|
|
|
72a0dc |
GObject parent;
|
|
|
72a0dc |
|
|
|
72a0dc |
@@ -54,6 +57,7 @@ struct _ShellGlobal {
|
|
|
72a0dc |
|
|
|
72a0dc |
MetaBackend *backend;
|
|
|
72a0dc |
MetaDisplay *meta_display;
|
|
|
72a0dc |
+ ShimMetaContext *meta_context;
|
|
|
72a0dc |
MetaWorkspaceManager *workspace_manager;
|
|
|
72a0dc |
Display *xdisplay;
|
|
|
72a0dc |
|
|
|
72a0dc |
@@ -92,6 +96,7 @@ enum {
|
|
|
72a0dc |
|
|
|
72a0dc |
PROP_SESSION_MODE,
|
|
|
72a0dc |
PROP_BACKEND,
|
|
|
72a0dc |
+ PROP_CONTEXT,
|
|
|
72a0dc |
PROP_DISPLAY,
|
|
|
72a0dc |
PROP_WORKSPACE_MANAGER,
|
|
|
72a0dc |
PROP_SCREEN_WIDTH,
|
|
|
72a0dc |
@@ -235,6 +240,9 @@ shell_global_get_property(GObject *object,
|
|
|
72a0dc |
case PROP_BACKEND:
|
|
|
72a0dc |
g_value_set_object (value, global->backend);
|
|
|
72a0dc |
break;
|
|
|
72a0dc |
+ case PROP_CONTEXT:
|
|
|
72a0dc |
+ g_value_set_object (value, global->meta_context);
|
|
|
72a0dc |
+ break;
|
|
|
72a0dc |
case PROP_DISPLAY:
|
|
|
72a0dc |
g_value_set_object (value, global->meta_display);
|
|
|
72a0dc |
break;
|
|
|
72a0dc |
@@ -514,6 +522,13 @@ shell_global_class_init (ShellGlobalClass *klass)
|
|
|
72a0dc |
"MetaBackend object",
|
|
|
72a0dc |
META_TYPE_BACKEND,
|
|
|
72a0dc |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
|
|
72a0dc |
+ g_object_class_install_property (gobject_class,
|
|
|
72a0dc |
+ PROP_CONTEXT,
|
|
|
72a0dc |
+ g_param_spec_object ("context",
|
|
|
72a0dc |
+ "Context",
|
|
|
72a0dc |
+ "MetaContext object",
|
|
|
72a0dc |
+ G_TYPE_OBJECT,
|
|
|
72a0dc |
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
|
|
72a0dc |
g_object_class_install_property (gobject_class,
|
|
|
72a0dc |
PROP_DISPLAY,
|
|
|
72a0dc |
g_param_spec_object ("display",
|
|
|
72a0dc |
@@ -996,6 +1011,7 @@ _shell_global_set_plugin (ShellGlobal *global,
|
|
|
72a0dc |
|
|
|
72a0dc |
display = meta_plugin_get_display (plugin);
|
|
|
72a0dc |
global->meta_display = display;
|
|
|
72a0dc |
+ global->meta_context = g_object_new (SHIM_TYPE_META_CONTEXT, NULL);
|
|
|
72a0dc |
global->workspace_manager = meta_display_get_workspace_manager (display);
|
|
|
72a0dc |
|
|
|
72a0dc |
global->stage = CLUTTER_STAGE (meta_get_stage_for_display (display));
|
|
|
72a0dc |
@@ -1888,3 +1904,79 @@ _shell_global_locate_pointer (ShellGlobal *global)
|
|
|
72a0dc |
{
|
|
|
72a0dc |
g_signal_emit (global, shell_global_signals[LOCATE_POINTER], 0);
|
|
|
72a0dc |
}
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+enum {
|
|
|
72a0dc |
+ SHIM_PROP_0,
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+ SHIM_PROP_UNSAFE_MODE,
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+ N_SHIM_PROPS
|
|
|
72a0dc |
+};
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+static GParamSpec *shim_obj_props [N_SHIM_PROPS];
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+struct _ShimMetaContext
|
|
|
72a0dc |
+{
|
|
|
72a0dc |
+ GObject parent_instance;
|
|
|
72a0dc |
+};
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+G_DEFINE_TYPE (ShimMetaContext, shim_meta_context, G_TYPE_OBJECT);
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+static void
|
|
|
72a0dc |
+shim_meta_context_get_property (GObject *object,
|
|
|
72a0dc |
+ guint prop_id,
|
|
|
72a0dc |
+ GValue *value,
|
|
|
72a0dc |
+ GParamSpec *pspec)
|
|
|
72a0dc |
+{
|
|
|
72a0dc |
+ switch (prop_id)
|
|
|
72a0dc |
+ {
|
|
|
72a0dc |
+ case SHIM_PROP_UNSAFE_MODE:
|
|
|
72a0dc |
+ {
|
|
|
72a0dc |
+ gboolean unsafe_mode;
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+ g_object_get (meta_get_backend (), "unsafe-mode", &unsafe_mode, NULL);
|
|
|
72a0dc |
+ g_value_set_boolean (value, unsafe_mode);
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
+ break;
|
|
|
72a0dc |
+ default:
|
|
|
72a0dc |
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
+}
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+static void
|
|
|
72a0dc |
+shim_meta_context_set_property (GObject *object,
|
|
|
72a0dc |
+ guint prop_id,
|
|
|
72a0dc |
+ const GValue *value,
|
|
|
72a0dc |
+ GParamSpec *pspec)
|
|
|
72a0dc |
+{
|
|
|
72a0dc |
+ switch (prop_id)
|
|
|
72a0dc |
+ {
|
|
|
72a0dc |
+ case SHIM_PROP_UNSAFE_MODE:
|
|
|
72a0dc |
+ g_object_set_property (G_OBJECT (meta_get_backend ()), "unsafe-mode", value);
|
|
|
72a0dc |
+ break;
|
|
|
72a0dc |
+ default:
|
|
|
72a0dc |
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
+}
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+static void
|
|
|
72a0dc |
+shim_meta_context_class_init (ShimMetaContextClass *klass)
|
|
|
72a0dc |
+{
|
|
|
72a0dc |
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+ object_class->get_property = shim_meta_context_get_property;
|
|
|
72a0dc |
+ object_class->set_property = shim_meta_context_set_property;
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+ shim_obj_props[SHIM_PROP_UNSAFE_MODE] =
|
|
|
72a0dc |
+ g_param_spec_boolean ("unsafe-mode",
|
|
|
72a0dc |
+ "unsafe mode",
|
|
|
72a0dc |
+ "Unsafe mode",
|
|
|
72a0dc |
+ FALSE,
|
|
|
72a0dc |
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
|
|
72a0dc |
+ g_object_class_install_properties (object_class, N_SHIM_PROPS, shim_obj_props);
|
|
|
72a0dc |
+}
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+static void
|
|
|
72a0dc |
+shim_meta_context_init (ShimMetaContext *self)
|
|
|
72a0dc |
+{
|
|
|
72a0dc |
+}
|
|
|
72a0dc |
--
|
|
|
72a0dc |
2.35.1
|
|
|
72a0dc |
|
|
|
72a0dc |
|
|
|
72a0dc |
From 20fcc7bc78a3c227304e89deddc57266e560175c Mon Sep 17 00:00:00 2001
|
|
|
72a0dc |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
72a0dc |
Date: Thu, 2 Sep 2021 17:15:36 +0200
|
|
|
72a0dc |
Subject: [PATCH 02/12] panel: Show warning indicator when unsafe-mode is on
|
|
|
72a0dc |
|
|
|
72a0dc |
MetaContext added an unsafe-mode property, which we will use to restrict
|
|
|
72a0dc |
a number of privileged operations unless it is enabled. It is meant to
|
|
|
72a0dc |
only be enabled temporarily for development/debugging purposes, so add
|
|
|
72a0dc |
a scary icon to the top bar as a reminder to turn it off again.
|
|
|
72a0dc |
|
|
|
72a0dc |
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3943
|
|
|
72a0dc |
|
|
|
72a0dc |
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970>
|
|
|
72a0dc |
---
|
|
|
72a0dc |
js/ui/panel.js | 16 ++++++++++++++++
|
|
|
72a0dc |
1 file changed, 16 insertions(+)
|
|
|
72a0dc |
|
|
|
72a0dc |
diff --git a/js/ui/panel.js b/js/ui/panel.js
|
|
|
72a0dc |
index 380480744..c57c3ba8e 100644
|
|
|
72a0dc |
--- a/js/ui/panel.js
|
|
|
72a0dc |
+++ b/js/ui/panel.js
|
|
|
72a0dc |
@@ -641,6 +641,20 @@ class PanelCorner extends St.DrawingArea {
|
|
|
72a0dc |
}
|
|
|
72a0dc |
});
|
|
|
72a0dc |
|
|
|
72a0dc |
+const UnsafeModeIndicator = GObject.registerClass(
|
|
|
72a0dc |
+class UnsafeModeIndicator extends PanelMenu.SystemIndicator {
|
|
|
72a0dc |
+ _init() {
|
|
|
72a0dc |
+ super._init();
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+ this._indicator = this._addIndicator();
|
|
|
72a0dc |
+ this._indicator.icon_name = 'channel-insecure-symbolic';
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+ global.context.bind_property('unsafe-mode',
|
|
|
72a0dc |
+ this._indicator, 'visible',
|
|
|
72a0dc |
+ GObject.BindingFlags.SYNC_CREATE);
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
+});
|
|
|
72a0dc |
+
|
|
|
72a0dc |
var AggregateLayout = GObject.registerClass(
|
|
|
72a0dc |
class AggregateLayout extends Clutter.BoxLayout {
|
|
|
72a0dc |
_init(params = {}) {
|
|
|
72a0dc |
@@ -702,6 +716,7 @@ class AggregateMenu extends PanelMenu.Button {
|
|
|
72a0dc |
this._location = new imports.ui.status.location.Indicator();
|
|
|
72a0dc |
this._nightLight = new imports.ui.status.nightLight.Indicator();
|
|
|
72a0dc |
this._thunderbolt = new imports.ui.status.thunderbolt.Indicator();
|
|
|
72a0dc |
+ this._unsafeMode = new UnsafeModeIndicator();
|
|
|
72a0dc |
|
|
|
72a0dc |
this._indicators.add_child(this._remoteAccess);
|
|
|
72a0dc |
this._indicators.add_child(this._thunderbolt);
|
|
|
72a0dc |
@@ -713,6 +728,7 @@ class AggregateMenu extends PanelMenu.Button {
|
|
|
72a0dc |
this._indicators.add_child(this._bluetooth);
|
|
|
72a0dc |
this._indicators.add_child(this._rfkill);
|
|
|
72a0dc |
this._indicators.add_child(this._volume);
|
|
|
72a0dc |
+ this._indicators.add_child(this._unsafeMode);
|
|
|
72a0dc |
this._indicators.add_child(this._power);
|
|
|
72a0dc |
this._indicators.add_child(this._powerProfiles);
|
|
|
72a0dc |
|
|
|
72a0dc |
--
|
|
|
72a0dc |
2.35.1
|
|
|
72a0dc |
|
|
|
72a0dc |
|
|
|
72a0dc |
From 158eeebc1d3a243e75de550cf5711e38a9f77f7f Mon Sep 17 00:00:00 2001
|
|
|
72a0dc |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
72a0dc |
Date: Thu, 17 Jun 2021 01:50:50 +0200
|
|
|
72a0dc |
Subject: [PATCH 03/12] shellDBus: Use MetaContext:unsafe-mode to restrict
|
|
|
72a0dc |
Eval()
|
|
|
72a0dc |
|
|
|
72a0dc |
The Eval() method is unarguably the most sensitive D-Bus method
|
|
|
72a0dc |
we expose, since it allows running arbitrary code in the compositor.
|
|
|
72a0dc |
|
|
|
72a0dc |
It is currently tied to the `development-tools` settings that is
|
|
|
72a0dc |
enabled by default. As users have become accustomed to the built-in
|
|
|
72a0dc |
commands that are enabled by the same setting (restart, lg, ...),
|
|
|
72a0dc |
that default cannot easily be changed.
|
|
|
72a0dc |
|
|
|
72a0dc |
In order to restrict the method without affecting the rather harmless
|
|
|
72a0dc |
commands, guard it by the new MetaContext:unsafe-mode property instead
|
|
|
72a0dc |
of the setting.
|
|
|
72a0dc |
|
|
|
72a0dc |
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3943
|
|
|
72a0dc |
|
|
|
72a0dc |
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970>
|
|
|
72a0dc |
---
|
|
|
72a0dc |
js/ui/shellDBus.js | 2 +-
|
|
|
72a0dc |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
72a0dc |
|
|
|
72a0dc |
diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js
|
|
|
72a0dc |
index 734ca4fc7..5a6edec74 100644
|
|
|
72a0dc |
--- a/js/ui/shellDBus.js
|
|
|
72a0dc |
+++ b/js/ui/shellDBus.js
|
|
|
72a0dc |
@@ -54,7 +54,7 @@ var GnomeShell = class {
|
|
|
72a0dc |
*
|
|
|
72a0dc |
*/
|
|
|
72a0dc |
Eval(code) {
|
|
|
72a0dc |
- if (!global.settings.get_boolean('development-tools'))
|
|
|
72a0dc |
+ if (!global.context.unsafe_mode)
|
|
|
72a0dc |
return [false, ''];
|
|
|
72a0dc |
|
|
|
72a0dc |
let returnValue;
|
|
|
72a0dc |
--
|
|
|
72a0dc |
2.35.1
|
|
|
72a0dc |
|
|
|
72a0dc |
|
|
|
72a0dc |
From 0882e04a11fe8db7abf05a5d7c786664dc54ad4f Mon Sep 17 00:00:00 2001
|
|
|
72a0dc |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
72a0dc |
Date: Thu, 2 Sep 2021 16:23:38 +0200
|
|
|
72a0dc |
Subject: [PATCH 04/12] introspect: Make invocation check error-based
|
|
|
72a0dc |
|
|
|
72a0dc |
If we throw an error when the invocation isn't allowed instead of
|
|
|
72a0dc |
returning false, we can simply return that error instead of duplicating
|
|
|
72a0dc |
the error handling.
|
|
|
72a0dc |
|
|
|
72a0dc |
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970>
|
|
|
72a0dc |
---
|
|
|
72a0dc |
js/misc/introspect.js | 26 ++++++++++++++------------
|
|
|
72a0dc |
1 file changed, 14 insertions(+), 12 deletions(-)
|
|
|
72a0dc |
|
|
|
72a0dc |
diff --git a/js/misc/introspect.js b/js/misc/introspect.js
|
|
|
72a0dc |
index e46a7e8c5..318955be2 100644
|
|
|
72a0dc |
--- a/js/misc/introspect.js
|
|
|
72a0dc |
+++ b/js/misc/introspect.js
|
|
|
72a0dc |
@@ -134,21 +134,23 @@ var IntrospectService = class {
|
|
|
72a0dc |
type == Meta.WindowType.UTILITY;
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
- _isInvocationAllowed(invocation) {
|
|
|
72a0dc |
+ _checkInvocation(invocation) {
|
|
|
72a0dc |
if (this._isIntrospectEnabled())
|
|
|
72a0dc |
- return true;
|
|
|
72a0dc |
+ return;
|
|
|
72a0dc |
|
|
|
72a0dc |
if (this._isSenderAllowed(invocation.get_sender()))
|
|
|
72a0dc |
- return true;
|
|
|
72a0dc |
+ return;
|
|
|
72a0dc |
|
|
|
72a0dc |
- return false;
|
|
|
72a0dc |
+ throw new GLib.Error(Gio.DBusError,
|
|
|
72a0dc |
+ Gio.DBusError.ACCESS_DENIED,
|
|
|
72a0dc |
+ 'App introspection not allowed');
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
GetRunningApplicationsAsync(params, invocation) {
|
|
|
72a0dc |
- if (!this._isInvocationAllowed(invocation)) {
|
|
|
72a0dc |
- invocation.return_error_literal(Gio.DBusError,
|
|
|
72a0dc |
- Gio.DBusError.ACCESS_DENIED,
|
|
|
72a0dc |
- 'App introspection not allowed');
|
|
|
72a0dc |
+ try {
|
|
|
72a0dc |
+ this._checkInvocation(invocation);
|
|
|
72a0dc |
+ } catch (e) {
|
|
|
72a0dc |
+ invocation.return_gerror(e);
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
@@ -160,10 +162,10 @@ var IntrospectService = class {
|
|
|
72a0dc |
let apps = this._appSystem.get_running();
|
|
|
72a0dc |
let windowsList = {};
|
|
|
72a0dc |
|
|
|
72a0dc |
- if (!this._isInvocationAllowed(invocation)) {
|
|
|
72a0dc |
- invocation.return_error_literal(Gio.DBusError,
|
|
|
72a0dc |
- Gio.DBusError.ACCESS_DENIED,
|
|
|
72a0dc |
- 'App introspection not allowed');
|
|
|
72a0dc |
+ try {
|
|
|
72a0dc |
+ this._checkInvocation(invocation);
|
|
|
72a0dc |
+ } catch (e) {
|
|
|
72a0dc |
+ invocation.return_gerror(e);
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
--
|
|
|
72a0dc |
2.35.1
|
|
|
72a0dc |
|
|
|
72a0dc |
|
|
|
72a0dc |
From 33c3c3846f62cc4737f0029455f9dcd838876bca Mon Sep 17 00:00:00 2001
|
|
|
72a0dc |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
72a0dc |
Date: Wed, 1 Sep 2021 21:18:42 +0200
|
|
|
72a0dc |
Subject: [PATCH 05/12] introspect: Use MetaContext:unsafe-mode instead of
|
|
|
72a0dc |
setting
|
|
|
72a0dc |
|
|
|
72a0dc |
The property was added precisely for this purpose, except that its
|
|
|
72a0dc |
name isn't tied to the introspect API.
|
|
|
72a0dc |
|
|
|
72a0dc |
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3943
|
|
|
72a0dc |
|
|
|
72a0dc |
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970>
|
|
|
72a0dc |
---
|
|
|
72a0dc |
js/misc/introspect.js | 12 +-----------
|
|
|
72a0dc |
1 file changed, 1 insertion(+), 11 deletions(-)
|
|
|
72a0dc |
|
|
|
72a0dc |
diff --git a/js/misc/introspect.js b/js/misc/introspect.js
|
|
|
72a0dc |
index 318955be2..967e7b830 100644
|
|
|
72a0dc |
--- a/js/misc/introspect.js
|
|
|
72a0dc |
+++ b/js/misc/introspect.js
|
|
|
72a0dc |
@@ -1,8 +1,6 @@
|
|
|
72a0dc |
/* exported IntrospectService */
|
|
|
72a0dc |
const { Gio, GLib, Meta, Shell, St } = imports.gi;
|
|
|
72a0dc |
|
|
|
72a0dc |
-const INTROSPECT_SCHEMA = 'org.gnome.shell';
|
|
|
72a0dc |
-const INTROSPECT_KEY = 'introspect';
|
|
|
72a0dc |
const APP_ALLOWLIST = ['org.freedesktop.impl.portal.desktop.gtk'];
|
|
|
72a0dc |
|
|
|
72a0dc |
const INTROSPECT_DBUS_API_VERSION = 3;
|
|
|
72a0dc |
@@ -33,10 +31,6 @@ var IntrospectService = class {
|
|
|
72a0dc |
this._syncRunningApplications();
|
|
|
72a0dc |
});
|
|
|
72a0dc |
|
|
|
72a0dc |
- this._introspectSettings = new Gio.Settings({
|
|
|
72a0dc |
- schema_id: INTROSPECT_SCHEMA,
|
|
|
72a0dc |
- });
|
|
|
72a0dc |
-
|
|
|
72a0dc |
let tracker = Shell.WindowTracker.get_default();
|
|
|
72a0dc |
tracker.connect('notify::focus-app',
|
|
|
72a0dc |
() => {
|
|
|
72a0dc |
@@ -70,10 +64,6 @@ var IntrospectService = class {
|
|
|
72a0dc |
return app.get_windows().some(w => w.transient_for == null);
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
- _isIntrospectEnabled() {
|
|
|
72a0dc |
- return this._introspectSettings.get_boolean(INTROSPECT_KEY);
|
|
|
72a0dc |
- }
|
|
|
72a0dc |
-
|
|
|
72a0dc |
_isSenderAllowed(sender) {
|
|
|
72a0dc |
return [...this._allowlistMap.values()].includes(sender);
|
|
|
72a0dc |
}
|
|
|
72a0dc |
@@ -135,7 +125,7 @@ var IntrospectService = class {
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
_checkInvocation(invocation) {
|
|
|
72a0dc |
- if (this._isIntrospectEnabled())
|
|
|
72a0dc |
+ if (global.context.unsafe_mode)
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
|
|
|
72a0dc |
if (this._isSenderAllowed(invocation.get_sender()))
|
|
|
72a0dc |
--
|
|
|
72a0dc |
2.35.1
|
|
|
72a0dc |
|
|
|
72a0dc |
|
|
|
72a0dc |
From 4238128ba403da2cc788b0b249ee34acbea5d743 Mon Sep 17 00:00:00 2001
|
|
|
72a0dc |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
72a0dc |
Date: Wed, 1 Sep 2021 21:25:26 +0200
|
|
|
72a0dc |
Subject: [PATCH 06/12] data: Remove now unused "introspect" setting
|
|
|
72a0dc |
|
|
|
72a0dc |
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3943
|
|
|
72a0dc |
|
|
|
72a0dc |
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970>
|
|
|
72a0dc |
---
|
|
|
72a0dc |
data/org.gnome.shell.gschema.xml.in | 8 --------
|
|
|
72a0dc |
1 file changed, 8 deletions(-)
|
|
|
72a0dc |
|
|
|
72a0dc |
diff --git a/data/org.gnome.shell.gschema.xml.in b/data/org.gnome.shell.gschema.xml.in
|
|
|
72a0dc |
index d5ea1e35f..6f1c424ba 100644
|
|
|
72a0dc |
--- a/data/org.gnome.shell.gschema.xml.in
|
|
|
72a0dc |
+++ b/data/org.gnome.shell.gschema.xml.in
|
|
|
72a0dc |
@@ -104,14 +104,6 @@
|
|
|
72a0dc |
number can be used to effectively disable the dialog.
|
|
|
72a0dc |
</description>
|
|
|
72a0dc |
</key>
|
|
|
72a0dc |
- <key name="introspect" type="b">
|
|
|
72a0dc |
- <default>false</default>
|
|
|
72a0dc |
- <summary>Enable introspection API</summary>
|
|
|
72a0dc |
- <description>
|
|
|
72a0dc |
- Enables a D-Bus API that allows to introspect the application state of
|
|
|
72a0dc |
- the shell.
|
|
|
72a0dc |
- </description>
|
|
|
72a0dc |
- </key>
|
|
|
72a0dc |
<key name="app-picker-layout" type="aa{sv}">
|
|
|
72a0dc |
<default>
|
|
|
72a0dc |
[{
|
|
|
72a0dc |
--
|
|
|
72a0dc |
2.35.1
|
|
|
72a0dc |
|
|
|
72a0dc |
|
|
|
72a0dc |
From f6af47b55fa2a52c7cdfecf1bb7e83d7f435a6bd Mon Sep 17 00:00:00 2001
|
|
|
72a0dc |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
72a0dc |
Date: Wed, 16 Jun 2021 19:09:42 +0200
|
|
|
72a0dc |
Subject: [PATCH 07/12] introspect: Split out DBusSenderChecker
|
|
|
72a0dc |
|
|
|
72a0dc |
Restricting callers to a list of allowed senders is useful for
|
|
|
72a0dc |
other D-Bus services as well, so split out the existing code
|
|
|
72a0dc |
into a reusable class.
|
|
|
72a0dc |
|
|
|
72a0dc |
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3943
|
|
|
72a0dc |
|
|
|
72a0dc |
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970>
|
|
|
72a0dc |
---
|
|
|
72a0dc |
js/misc/introspect.js | 30 ++++-------------------
|
|
|
72a0dc |
js/misc/util.js | 56 ++++++++++++++++++++++++++++++++++++++++++-
|
|
|
72a0dc |
2 files changed, 59 insertions(+), 27 deletions(-)
|
|
|
72a0dc |
|
|
|
72a0dc |
diff --git a/js/misc/introspect.js b/js/misc/introspect.js
|
|
|
72a0dc |
index 967e7b830..e9d9260c0 100644
|
|
|
72a0dc |
--- a/js/misc/introspect.js
|
|
|
72a0dc |
+++ b/js/misc/introspect.js
|
|
|
72a0dc |
@@ -6,6 +6,7 @@ const APP_ALLOWLIST = ['org.freedesktop.impl.portal.desktop.gtk'];
|
|
|
72a0dc |
const INTROSPECT_DBUS_API_VERSION = 3;
|
|
|
72a0dc |
|
|
|
72a0dc |
const { loadInterfaceXML } = imports.misc.fileUtils;
|
|
|
72a0dc |
+const { DBusSenderChecker } = imports.misc.util;
|
|
|
72a0dc |
|
|
|
72a0dc |
const IntrospectDBusIface = loadInterfaceXML('org.gnome.Shell.Introspect');
|
|
|
72a0dc |
|
|
|
72a0dc |
@@ -40,14 +41,7 @@ var IntrospectService = class {
|
|
|
72a0dc |
|
|
|
72a0dc |
this._syncRunningApplications();
|
|
|
72a0dc |
|
|
|
72a0dc |
- this._allowlistMap = new Map();
|
|
|
72a0dc |
- APP_ALLOWLIST.forEach(appName => {
|
|
|
72a0dc |
- Gio.DBus.watch_name(Gio.BusType.SESSION,
|
|
|
72a0dc |
- appName,
|
|
|
72a0dc |
- Gio.BusNameWatcherFlags.NONE,
|
|
|
72a0dc |
- (conn, name, owner) => this._allowlistMap.set(name, owner),
|
|
|
72a0dc |
- (conn, name) => this._allowlistMap.delete(name));
|
|
|
72a0dc |
- });
|
|
|
72a0dc |
+ this._senderChecker = new DBusSenderChecker(APP_ALLOWLIST);
|
|
|
72a0dc |
|
|
|
72a0dc |
this._settings = St.Settings.get();
|
|
|
72a0dc |
this._settings.connect('notify::enable-animations',
|
|
|
72a0dc |
@@ -64,10 +58,6 @@ var IntrospectService = class {
|
|
|
72a0dc |
return app.get_windows().some(w => w.transient_for == null);
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
- _isSenderAllowed(sender) {
|
|
|
72a0dc |
- return [...this._allowlistMap.values()].includes(sender);
|
|
|
72a0dc |
- }
|
|
|
72a0dc |
-
|
|
|
72a0dc |
_getSandboxedAppId(app) {
|
|
|
72a0dc |
let ids = app.get_windows().map(w => w.get_sandboxed_app_id());
|
|
|
72a0dc |
return ids.find(id => id != null);
|
|
|
72a0dc |
@@ -124,21 +114,9 @@ var IntrospectService = class {
|
|
|
72a0dc |
type == Meta.WindowType.UTILITY;
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
- _checkInvocation(invocation) {
|
|
|
72a0dc |
- if (global.context.unsafe_mode)
|
|
|
72a0dc |
- return;
|
|
|
72a0dc |
-
|
|
|
72a0dc |
- if (this._isSenderAllowed(invocation.get_sender()))
|
|
|
72a0dc |
- return;
|
|
|
72a0dc |
-
|
|
|
72a0dc |
- throw new GLib.Error(Gio.DBusError,
|
|
|
72a0dc |
- Gio.DBusError.ACCESS_DENIED,
|
|
|
72a0dc |
- 'App introspection not allowed');
|
|
|
72a0dc |
- }
|
|
|
72a0dc |
-
|
|
|
72a0dc |
GetRunningApplicationsAsync(params, invocation) {
|
|
|
72a0dc |
try {
|
|
|
72a0dc |
- this._checkInvocation(invocation);
|
|
|
72a0dc |
+ this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
} catch (e) {
|
|
|
72a0dc |
invocation.return_gerror(e);
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
@@ -153,7 +131,7 @@ var IntrospectService = class {
|
|
|
72a0dc |
let windowsList = {};
|
|
|
72a0dc |
|
|
|
72a0dc |
try {
|
|
|
72a0dc |
- this._checkInvocation(invocation);
|
|
|
72a0dc |
+ this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
} catch (e) {
|
|
|
72a0dc |
invocation.return_gerror(e);
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
diff --git a/js/misc/util.js b/js/misc/util.js
|
|
|
72a0dc |
index 802398d18..e6c183fbf 100644
|
|
|
72a0dc |
--- a/js/misc/util.js
|
|
|
72a0dc |
+++ b/js/misc/util.js
|
|
|
72a0dc |
@@ -2,7 +2,7 @@
|
|
|
72a0dc |
/* exported findUrls, spawn, spawnCommandLine, spawnApp, trySpawnCommandLine,
|
|
|
72a0dc |
formatTime, formatTimeSpan, createTimeLabel, insertSorted,
|
|
|
72a0dc |
ensureActorVisibleInScrollView, wiggle, lerp, GNOMEversionCompare,
|
|
|
72a0dc |
- Highlighter */
|
|
|
72a0dc |
+ DBusSenderChecker, Highlighter */
|
|
|
72a0dc |
|
|
|
72a0dc |
const { Clutter, Gio, GLib, Shell, St, GnomeDesktop } = imports.gi;
|
|
|
72a0dc |
const Gettext = imports.gettext;
|
|
|
72a0dc |
@@ -479,6 +479,60 @@ function GNOMEversionCompare(version1, version2) {
|
|
|
72a0dc |
return 0;
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
+var DBusSenderChecker = class {
|
|
|
72a0dc |
+ /**
|
|
|
72a0dc |
+ * @param {string[]} allowList - list of allowed well-known names
|
|
|
72a0dc |
+ */
|
|
|
72a0dc |
+ constructor(allowList) {
|
|
|
72a0dc |
+ this._allowlistMap = new Map();
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+ this._watchList = allowList.map(name => {
|
|
|
72a0dc |
+ return Gio.DBus.watch_name(Gio.BusType.SESSION,
|
|
|
72a0dc |
+ name,
|
|
|
72a0dc |
+ Gio.BusNameWatcherFlags.NONE,
|
|
|
72a0dc |
+ (conn_, name_, owner) => this._allowlistMap.set(name, owner),
|
|
|
72a0dc |
+ () => this._allowlistMap.delete(name));
|
|
|
72a0dc |
+ });
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+ /**
|
|
|
72a0dc |
+ * @param {string} sender - the bus name that invoked the checked method
|
|
|
72a0dc |
+ * @returns {bool}
|
|
|
72a0dc |
+ */
|
|
|
72a0dc |
+ _isSenderAllowed(sender) {
|
|
|
72a0dc |
+ return [...this._allowlistMap.values()].includes(sender);
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+ /**
|
|
|
72a0dc |
+ * Check whether the bus name that invoked @invocation maps
|
|
|
72a0dc |
+ * to an entry in the allow list.
|
|
|
72a0dc |
+ *
|
|
|
72a0dc |
+ * @throws
|
|
|
72a0dc |
+ * @param {Gio.DBusMethodInvocation} invocation - the invocation
|
|
|
72a0dc |
+ * @returns {void}
|
|
|
72a0dc |
+ */
|
|
|
72a0dc |
+ checkInvocation(invocation) {
|
|
|
72a0dc |
+ if (global.context.unsafe_mode)
|
|
|
72a0dc |
+ return;
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+ if (this._isSenderAllowed(invocation.get_sender()))
|
|
|
72a0dc |
+ return;
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+ throw new GLib.Error(Gio.DBusError,
|
|
|
72a0dc |
+ Gio.DBusError.ACCESS_DENIED,
|
|
|
72a0dc |
+ '%s is not allowed'.format(invocation.get_method_name()));
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+ /**
|
|
|
72a0dc |
+ * @returns {void}
|
|
|
72a0dc |
+ */
|
|
|
72a0dc |
+ destroy() {
|
|
|
72a0dc |
+ for (const id in this._watchList)
|
|
|
72a0dc |
+ Gio.DBus.unwatch_name(id);
|
|
|
72a0dc |
+ this._watchList = [];
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
+};
|
|
|
72a0dc |
+
|
|
|
72a0dc |
/* @class Highlighter Highlight given terms in text using markup. */
|
|
|
72a0dc |
var Highlighter = class {
|
|
|
72a0dc |
/**
|
|
|
72a0dc |
--
|
|
|
72a0dc |
2.35.1
|
|
|
72a0dc |
|
|
|
72a0dc |
|
|
|
72a0dc |
From c6679a876a3c73c2c691333a5b987e27965231f3 Mon Sep 17 00:00:00 2001
|
|
|
72a0dc |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
72a0dc |
Date: Thu, 17 Jun 2021 15:29:42 +0200
|
|
|
72a0dc |
Subject: [PATCH 08/12] shellDBus: Implement all methods asynchronously
|
|
|
72a0dc |
|
|
|
72a0dc |
In order to restrict callers, we will need access to the invocation,
|
|
|
72a0dc |
not just the unpacked method parameters.
|
|
|
72a0dc |
|
|
|
72a0dc |
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3943
|
|
|
72a0dc |
|
|
|
72a0dc |
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970>
|
|
|
72a0dc |
---
|
|
|
72a0dc |
js/ui/shellDBus.js | 31 ++++++++++++++++++++++++++++---
|
|
|
72a0dc |
1 file changed, 28 insertions(+), 3 deletions(-)
|
|
|
72a0dc |
|
|
|
72a0dc |
diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js
|
|
|
72a0dc |
index 5a6edec74..aa5b4dc3c 100644
|
|
|
72a0dc |
--- a/js/ui/shellDBus.js
|
|
|
72a0dc |
+++ b/js/ui/shellDBus.js
|
|
|
72a0dc |
@@ -72,11 +72,26 @@ var GnomeShell = class {
|
|
|
72a0dc |
return [success, returnValue];
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
- FocusSearch() {
|
|
|
72a0dc |
+ /**
|
|
|
72a0dc |
+ * Focus the overview's search entry
|
|
|
72a0dc |
+ *
|
|
|
72a0dc |
+ * @param {...any} params - method parameters
|
|
|
72a0dc |
+ * @param {Gio.DBusMethodInvocation} invocation - the invocation
|
|
|
72a0dc |
+ * @returns {void}
|
|
|
72a0dc |
+ */
|
|
|
72a0dc |
+ FocusSearchAsync(params, invocation) {
|
|
|
72a0dc |
Main.overview.focusSearch();
|
|
|
72a0dc |
+ invocation.return_value(null);
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
- ShowOSD(params) {
|
|
|
72a0dc |
+ /**
|
|
|
72a0dc |
+ * Show OSD with the specified parameters
|
|
|
72a0dc |
+ *
|
|
|
72a0dc |
+ * @param {...any} params - method parameters
|
|
|
72a0dc |
+ * @param {Gio.DBusMethodInvocation} invocation - the invocation
|
|
|
72a0dc |
+ * @returns {void}
|
|
|
72a0dc |
+ */
|
|
|
72a0dc |
+ ShowOSDAsync([params], invocation) {
|
|
|
72a0dc |
for (let param in params)
|
|
|
72a0dc |
params[param] = params[param].deep_unpack();
|
|
|
72a0dc |
|
|
|
72a0dc |
@@ -97,6 +112,7 @@ var GnomeShell = class {
|
|
|
72a0dc |
icon = Gio.Icon.new_for_string(serializedIcon);
|
|
|
72a0dc |
|
|
|
72a0dc |
Main.osdWindowManager.show(monitorIndex, icon, label, level, maxLevel);
|
|
|
72a0dc |
+ invocation.return_value(null);
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
/**
|
|
|
72a0dc |
@@ -118,10 +134,19 @@ var GnomeShell = class {
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
Main.overview.selectApp(id);
|
|
|
72a0dc |
+ invocation.return_value(null);
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
- ShowApplications() {
|
|
|
72a0dc |
+ /**
|
|
|
72a0dc |
+ * Show the overview's app grid
|
|
|
72a0dc |
+ *
|
|
|
72a0dc |
+ * @param {...any} params - method parameters
|
|
|
72a0dc |
+ * @param {Gio.DBusMethodInvocation} invocation - the invocation
|
|
|
72a0dc |
+ * @returns {void}
|
|
|
72a0dc |
+ */
|
|
|
72a0dc |
+ ShowApplicationsAsync(params, invocation) {
|
|
|
72a0dc |
Main.overview.show(ControlsState.APP_GRID);
|
|
|
72a0dc |
+ invocation.return_value(null);
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
GrabAcceleratorAsync(params, invocation) {
|
|
|
72a0dc |
--
|
|
|
72a0dc |
2.35.1
|
|
|
72a0dc |
|
|
|
72a0dc |
|
|
|
72a0dc |
From 3ad733997eecb069be543f1a4452d7a7916a0962 Mon Sep 17 00:00:00 2001
|
|
|
72a0dc |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
72a0dc |
Date: Thu, 17 Jun 2021 15:29:42 +0200
|
|
|
72a0dc |
Subject: [PATCH 09/12] shellDBus: Restrict callers
|
|
|
72a0dc |
|
|
|
72a0dc |
The org.gnome.Shell interface provides a private API to other core
|
|
|
72a0dc |
components to implement desktop functionalities like Settings or
|
|
|
72a0dc |
global keybindings. It is not meant as a public API, so limit it
|
|
|
72a0dc |
to a set of expected callers.
|
|
|
72a0dc |
|
|
|
72a0dc |
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3943
|
|
|
72a0dc |
|
|
|
72a0dc |
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970>
|
|
|
72a0dc |
---
|
|
|
72a0dc |
js/ui/shellDBus.js | 76 ++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
72a0dc |
1 file changed, 76 insertions(+)
|
|
|
72a0dc |
|
|
|
72a0dc |
diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js
|
|
|
72a0dc |
index aa5b4dc3c..c511314f9 100644
|
|
|
72a0dc |
--- a/js/ui/shellDBus.js
|
|
|
72a0dc |
+++ b/js/ui/shellDBus.js
|
|
|
72a0dc |
@@ -10,6 +10,7 @@ const Main = imports.ui.main;
|
|
|
72a0dc |
const Screenshot = imports.ui.screenshot;
|
|
|
72a0dc |
|
|
|
72a0dc |
const { loadInterfaceXML } = imports.misc.fileUtils;
|
|
|
72a0dc |
+const { DBusSenderChecker } = imports.misc.util;
|
|
|
72a0dc |
const { ControlsState } = imports.ui.overviewControls;
|
|
|
72a0dc |
|
|
|
72a0dc |
const GnomeShellIface = loadInterfaceXML('org.gnome.Shell');
|
|
|
72a0dc |
@@ -20,6 +21,11 @@ var GnomeShell = class {
|
|
|
72a0dc |
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(GnomeShellIface, this);
|
|
|
72a0dc |
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/Shell');
|
|
|
72a0dc |
|
|
|
72a0dc |
+ this._senderChecker = new DBusSenderChecker([
|
|
|
72a0dc |
+ 'org.gnome.ControlCenter',
|
|
|
72a0dc |
+ 'org.gnome.SettingsDaemon.MediaKeys',
|
|
|
72a0dc |
+ ]);
|
|
|
72a0dc |
+
|
|
|
72a0dc |
this._extensionsService = new GnomeShellExtensions();
|
|
|
72a0dc |
this._screenshotService = new Screenshot.ScreenshotService();
|
|
|
72a0dc |
|
|
|
72a0dc |
@@ -80,6 +86,13 @@ var GnomeShell = class {
|
|
|
72a0dc |
* @returns {void}
|
|
|
72a0dc |
*/
|
|
|
72a0dc |
FocusSearchAsync(params, invocation) {
|
|
|
72a0dc |
+ try {
|
|
|
72a0dc |
+ this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ } catch (e) {
|
|
|
72a0dc |
+ invocation.return_gerror(e);
|
|
|
72a0dc |
+ return;
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
+
|
|
|
72a0dc |
Main.overview.focusSearch();
|
|
|
72a0dc |
invocation.return_value(null);
|
|
|
72a0dc |
}
|
|
|
72a0dc |
@@ -92,6 +105,13 @@ var GnomeShell = class {
|
|
|
72a0dc |
* @returns {void}
|
|
|
72a0dc |
*/
|
|
|
72a0dc |
ShowOSDAsync([params], invocation) {
|
|
|
72a0dc |
+ try {
|
|
|
72a0dc |
+ this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ } catch (e) {
|
|
|
72a0dc |
+ invocation.return_gerror(e);
|
|
|
72a0dc |
+ return;
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
+
|
|
|
72a0dc |
for (let param in params)
|
|
|
72a0dc |
params[param] = params[param].deep_unpack();
|
|
|
72a0dc |
|
|
|
72a0dc |
@@ -124,6 +144,13 @@ var GnomeShell = class {
|
|
|
72a0dc |
* @returns {void}
|
|
|
72a0dc |
*/
|
|
|
72a0dc |
FocusAppAsync([id], invocation) {
|
|
|
72a0dc |
+ try {
|
|
|
72a0dc |
+ this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ } catch (e) {
|
|
|
72a0dc |
+ invocation.return_gerror(e);
|
|
|
72a0dc |
+ return;
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
+
|
|
|
72a0dc |
const appSys = Shell.AppSystem.get_default();
|
|
|
72a0dc |
if (appSys.lookup_app(id) === null) {
|
|
|
72a0dc |
invocation.return_error_literal(
|
|
|
72a0dc |
@@ -145,11 +172,25 @@ var GnomeShell = class {
|
|
|
72a0dc |
* @returns {void}
|
|
|
72a0dc |
*/
|
|
|
72a0dc |
ShowApplicationsAsync(params, invocation) {
|
|
|
72a0dc |
+ try {
|
|
|
72a0dc |
+ this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ } catch (e) {
|
|
|
72a0dc |
+ invocation.return_gerror(e);
|
|
|
72a0dc |
+ return;
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
+
|
|
|
72a0dc |
Main.overview.show(ControlsState.APP_GRID);
|
|
|
72a0dc |
invocation.return_value(null);
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
GrabAcceleratorAsync(params, invocation) {
|
|
|
72a0dc |
+ try {
|
|
|
72a0dc |
+ this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ } catch (e) {
|
|
|
72a0dc |
+ invocation.return_gerror(e);
|
|
|
72a0dc |
+ return;
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
+
|
|
|
72a0dc |
let [accel, modeFlags, grabFlags] = params;
|
|
|
72a0dc |
let sender = invocation.get_sender();
|
|
|
72a0dc |
let bindingAction = this._grabAcceleratorForSender(accel, modeFlags, grabFlags, sender);
|
|
|
72a0dc |
@@ -157,6 +198,13 @@ var GnomeShell = class {
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
GrabAcceleratorsAsync(params, invocation) {
|
|
|
72a0dc |
+ try {
|
|
|
72a0dc |
+ this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ } catch (e) {
|
|
|
72a0dc |
+ invocation.return_gerror(e);
|
|
|
72a0dc |
+ return;
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
+
|
|
|
72a0dc |
let [accels] = params;
|
|
|
72a0dc |
let sender = invocation.get_sender();
|
|
|
72a0dc |
let bindingActions = [];
|
|
|
72a0dc |
@@ -168,6 +216,13 @@ var GnomeShell = class {
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
UngrabAcceleratorAsync(params, invocation) {
|
|
|
72a0dc |
+ try {
|
|
|
72a0dc |
+ this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ } catch (e) {
|
|
|
72a0dc |
+ invocation.return_gerror(e);
|
|
|
72a0dc |
+ return;
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
+
|
|
|
72a0dc |
let [action] = params;
|
|
|
72a0dc |
let sender = invocation.get_sender();
|
|
|
72a0dc |
let ungrabSucceeded = this._ungrabAcceleratorForSender(action, sender);
|
|
|
72a0dc |
@@ -176,6 +231,13 @@ var GnomeShell = class {
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
UngrabAcceleratorsAsync(params, invocation) {
|
|
|
72a0dc |
+ try {
|
|
|
72a0dc |
+ this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ } catch (e) {
|
|
|
72a0dc |
+ invocation.return_gerror(e);
|
|
|
72a0dc |
+ return;
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
+
|
|
|
72a0dc |
let [actions] = params;
|
|
|
72a0dc |
let sender = invocation.get_sender();
|
|
|
72a0dc |
let ungrabSucceeded = true;
|
|
|
72a0dc |
@@ -256,6 +318,13 @@ var GnomeShell = class {
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
ShowMonitorLabelsAsync(params, invocation) {
|
|
|
72a0dc |
+ try {
|
|
|
72a0dc |
+ this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ } catch (e) {
|
|
|
72a0dc |
+ invocation.return_gerror(e);
|
|
|
72a0dc |
+ return;
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
+
|
|
|
72a0dc |
let sender = invocation.get_sender();
|
|
|
72a0dc |
let [dict] = params;
|
|
|
72a0dc |
Main.osdMonitorLabeler.show(sender, dict);
|
|
|
72a0dc |
@@ -263,6 +332,13 @@ var GnomeShell = class {
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
HideMonitorLabelsAsync(params, invocation) {
|
|
|
72a0dc |
+ try {
|
|
|
72a0dc |
+ this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ } catch (e) {
|
|
|
72a0dc |
+ invocation.return_gerror(e);
|
|
|
72a0dc |
+ return;
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
+
|
|
|
72a0dc |
let sender = invocation.get_sender();
|
|
|
72a0dc |
Main.osdMonitorLabeler.hide(sender);
|
|
|
72a0dc |
invocation.return_value(null);
|
|
|
72a0dc |
--
|
|
|
72a0dc |
2.35.1
|
|
|
72a0dc |
|
|
|
72a0dc |
|
|
|
72a0dc |
From 5b87782b4950742b6ae1b29777e7812c93892ad7 Mon Sep 17 00:00:00 2001
|
|
|
72a0dc |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
72a0dc |
Date: Wed, 16 Jun 2021 22:11:50 +0200
|
|
|
72a0dc |
Subject: [PATCH 10/12] screenshot: Restrict callers
|
|
|
72a0dc |
|
|
|
72a0dc |
The shell D-Bus API was always meant as a private API for core
|
|
|
72a0dc |
components, so enforce that by limiting caller to a list of
|
|
|
72a0dc |
allowed well-known names.
|
|
|
72a0dc |
|
|
|
72a0dc |
Applications that want to request a screenshot can use the corresponding
|
|
|
72a0dc |
desktop portal.
|
|
|
72a0dc |
|
|
|
72a0dc |
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3943
|
|
|
72a0dc |
|
|
|
72a0dc |
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970>
|
|
|
72a0dc |
---
|
|
|
72a0dc |
js/ui/screenshot.js | 28 ++++++++++++++++++++++++++++
|
|
|
72a0dc |
1 file changed, 28 insertions(+)
|
|
|
72a0dc |
|
|
|
72a0dc |
diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js
|
|
|
72a0dc |
index 81ab516b1..bf537b7d6 100644
|
|
|
72a0dc |
--- a/js/ui/screenshot.js
|
|
|
72a0dc |
+++ b/js/ui/screenshot.js
|
|
|
72a0dc |
@@ -15,6 +15,7 @@ Gio._promisify(Shell.Screenshot.prototype,
|
|
|
72a0dc |
'screenshot_area', 'screenshot_area_finish');
|
|
|
72a0dc |
|
|
|
72a0dc |
const { loadInterfaceXML } = imports.misc.fileUtils;
|
|
|
72a0dc |
+const { DBusSenderChecker } = imports.misc.util;
|
|
|
72a0dc |
|
|
|
72a0dc |
const ScreenshotIface = loadInterfaceXML('org.gnome.Shell.Screenshot');
|
|
|
72a0dc |
|
|
|
72a0dc |
@@ -24,6 +25,12 @@ var ScreenshotService = class {
|
|
|
72a0dc |
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/Shell/Screenshot');
|
|
|
72a0dc |
|
|
|
72a0dc |
this._screenShooter = new Map();
|
|
|
72a0dc |
+ this._senderChecker = new DBusSenderChecker([
|
|
|
72a0dc |
+ 'org.gnome.SettingsDaemon.MediaKeys',
|
|
|
72a0dc |
+ 'org.freedesktop.impl.portal.desktop.gtk',
|
|
|
72a0dc |
+ 'org.freedesktop.impl.portal.desktop.gnome',
|
|
|
72a0dc |
+ 'org.gnome.Screenshot',
|
|
|
72a0dc |
+ ]);
|
|
|
72a0dc |
|
|
|
72a0dc |
this._lockdownSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.lockdown' });
|
|
|
72a0dc |
|
|
|
72a0dc |
@@ -46,6 +53,13 @@ var ScreenshotService = class {
|
|
|
72a0dc |
Gio.IOErrorEnum, Gio.IOErrorEnum.PERMISSION_DENIED,
|
|
|
72a0dc |
'Saving to disk is disabled');
|
|
|
72a0dc |
return null;
|
|
|
72a0dc |
+ } else {
|
|
|
72a0dc |
+ try {
|
|
|
72a0dc |
+ this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ } catch (e) {
|
|
|
72a0dc |
+ invocation.return_gerror(e);
|
|
|
72a0dc |
+ return null;
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
let shooter = new Shell.Screenshot();
|
|
|
72a0dc |
@@ -254,6 +268,13 @@ var ScreenshotService = class {
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
async SelectAreaAsync(params, invocation) {
|
|
|
72a0dc |
+ try {
|
|
|
72a0dc |
+ this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ } catch (e) {
|
|
|
72a0dc |
+ invocation.return_gerror(e);
|
|
|
72a0dc |
+ return;
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
+
|
|
|
72a0dc |
let selectArea = new SelectArea();
|
|
|
72a0dc |
try {
|
|
|
72a0dc |
let areaRectangle = await selectArea.selectAsync();
|
|
|
72a0dc |
@@ -269,6 +290,13 @@ var ScreenshotService = class {
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
FlashAreaAsync(params, invocation) {
|
|
|
72a0dc |
+ try {
|
|
|
72a0dc |
+ this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ } catch (e) {
|
|
|
72a0dc |
+ invocation.return_gerror(e);
|
|
|
72a0dc |
+ return;
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
+
|
|
|
72a0dc |
let [x, y, width, height] = params;
|
|
|
72a0dc |
[x, y, width, height] = this._scaleArea(x, y, width, height);
|
|
|
72a0dc |
if (!this._checkArea(x, y, width, height)) {
|
|
|
72a0dc |
--
|
|
|
72a0dc |
2.35.1
|
|
|
72a0dc |
|
|
|
72a0dc |
|
|
|
72a0dc |
From b02e721663ed1481ff7b4cf40cae3a34d059d90c Mon Sep 17 00:00:00 2001
|
|
|
72a0dc |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
72a0dc |
Date: Sat, 25 Sep 2021 14:15:32 +0200
|
|
|
72a0dc |
Subject: [PATCH 11/12] screenshot: Unrestrict PickColor
|
|
|
72a0dc |
|
|
|
72a0dc |
Commit dd2cd6286cd3 restricted callers of the screenshot methods to
|
|
|
72a0dc |
portal implementations, gnome-settings-daemon and gnome-screenshot.
|
|
|
72a0dc |
|
|
|
72a0dc |
That restriction does make sense for the actual screenshot methods,
|
|
|
72a0dc |
but `PickColor` is actually used by GTK in its color picker (and
|
|
|
72a0dc |
therefore may be called from arbitrary applications).
|
|
|
72a0dc |
|
|
|
72a0dc |
Fix this by unrestricting access to `PickColor` again. Considering that
|
|
|
72a0dc |
the method is always interactive, it's not very privacy/security-sensitive
|
|
|
72a0dc |
anyway.
|
|
|
72a0dc |
|
|
|
72a0dc |
https://gitlab.gnome.org/GNOME/gtk/-/issues/4283
|
|
|
72a0dc |
|
|
|
72a0dc |
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1990>
|
|
|
72a0dc |
---
|
|
|
72a0dc |
js/ui/screenshot.js | 6 +++---
|
|
|
72a0dc |
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
72a0dc |
|
|
|
72a0dc |
diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js
|
|
|
72a0dc |
index bf537b7d6..ae1156f47 100644
|
|
|
72a0dc |
--- a/js/ui/screenshot.js
|
|
|
72a0dc |
+++ b/js/ui/screenshot.js
|
|
|
72a0dc |
@@ -37,7 +37,7 @@ var ScreenshotService = class {
|
|
|
72a0dc |
Gio.DBus.session.own_name('org.gnome.Shell.Screenshot', Gio.BusNameOwnerFlags.REPLACE, null, null);
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
- _createScreenshot(invocation, needsDisk = true) {
|
|
|
72a0dc |
+ _createScreenshot(invocation, needsDisk = true, restrictCallers = true) {
|
|
|
72a0dc |
let lockedDown = false;
|
|
|
72a0dc |
if (needsDisk)
|
|
|
72a0dc |
lockedDown = this._lockdownSettings.get_boolean('disable-save-to-disk');
|
|
|
72a0dc |
@@ -53,7 +53,7 @@ var ScreenshotService = class {
|
|
|
72a0dc |
Gio.IOErrorEnum, Gio.IOErrorEnum.PERMISSION_DENIED,
|
|
|
72a0dc |
'Saving to disk is disabled');
|
|
|
72a0dc |
return null;
|
|
|
72a0dc |
- } else {
|
|
|
72a0dc |
+ } else if (restrictCallers) {
|
|
|
72a0dc |
try {
|
|
|
72a0dc |
this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
} catch (e) {
|
|
|
72a0dc |
@@ -311,7 +311,7 @@ var ScreenshotService = class {
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
async PickColorAsync(params, invocation) {
|
|
|
72a0dc |
- const screenshot = this._createScreenshot(invocation, false);
|
|
|
72a0dc |
+ const screenshot = this._createScreenshot(invocation, false, false);
|
|
|
72a0dc |
if (!screenshot)
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
|
|
|
72a0dc |
--
|
|
|
72a0dc |
2.35.1
|
|
|
72a0dc |
|
|
|
72a0dc |
|
|
|
72a0dc |
From 9e8073afbf30aaea87aefd8201fc5e04f94edaf8 Mon Sep 17 00:00:00 2001
|
|
|
72a0dc |
From: Sebastian Keller <skeller@gnome.org>
|
|
|
72a0dc |
Date: Tue, 23 Nov 2021 02:48:04 +0100
|
|
|
72a0dc |
Subject: [PATCH 12/12] util: Wait for initial name owners in DBusSenderCheck
|
|
|
72a0dc |
before checking
|
|
|
72a0dc |
|
|
|
72a0dc |
Otherwise an allowed caller might get rejected if the call is right
|
|
|
72a0dc |
after a gnome-shell restart and the watchers have not finished running
|
|
|
72a0dc |
their callbacks yet.
|
|
|
72a0dc |
|
|
|
72a0dc |
Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4813
|
|
|
72a0dc |
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2048>
|
|
|
72a0dc |
(cherry picked from commit 85609a232d4088b058f23f4922b9a993dea95199)
|
|
|
72a0dc |
---
|
|
|
72a0dc |
js/misc/introspect.js | 8 ++++----
|
|
|
72a0dc |
js/misc/util.js | 33 ++++++++++++++++++++++++++++-----
|
|
|
72a0dc |
js/ui/screenshot.js | 18 +++++++++---------
|
|
|
72a0dc |
js/ui/shellDBus.js | 43 +++++++++++++++++++++++--------------------
|
|
|
72a0dc |
4 files changed, 64 insertions(+), 38 deletions(-)
|
|
|
72a0dc |
|
|
|
72a0dc |
diff --git a/js/misc/introspect.js b/js/misc/introspect.js
|
|
|
72a0dc |
index e9d9260c0..f3c938af9 100644
|
|
|
72a0dc |
--- a/js/misc/introspect.js
|
|
|
72a0dc |
+++ b/js/misc/introspect.js
|
|
|
72a0dc |
@@ -114,9 +114,9 @@ var IntrospectService = class {
|
|
|
72a0dc |
type == Meta.WindowType.UTILITY;
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
- GetRunningApplicationsAsync(params, invocation) {
|
|
|
72a0dc |
+ async GetRunningApplicationsAsync(params, invocation) {
|
|
|
72a0dc |
try {
|
|
|
72a0dc |
- this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ await this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
} catch (e) {
|
|
|
72a0dc |
invocation.return_gerror(e);
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
@@ -125,13 +125,13 @@ var IntrospectService = class {
|
|
|
72a0dc |
invocation.return_value(new GLib.Variant('(a{sa{sv}})', [this._runningApplications]));
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
- GetWindowsAsync(params, invocation) {
|
|
|
72a0dc |
+ async GetWindowsAsync(params, invocation) {
|
|
|
72a0dc |
let focusWindow = global.display.get_focus_window();
|
|
|
72a0dc |
let apps = this._appSystem.get_running();
|
|
|
72a0dc |
let windowsList = {};
|
|
|
72a0dc |
|
|
|
72a0dc |
try {
|
|
|
72a0dc |
- this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ await this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
} catch (e) {
|
|
|
72a0dc |
invocation.return_gerror(e);
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
diff --git a/js/misc/util.js b/js/misc/util.js
|
|
|
72a0dc |
index e6c183fbf..6a0f6f641 100644
|
|
|
72a0dc |
--- a/js/misc/util.js
|
|
|
72a0dc |
+++ b/js/misc/util.js
|
|
|
72a0dc |
@@ -486,20 +486,42 @@ var DBusSenderChecker = class {
|
|
|
72a0dc |
constructor(allowList) {
|
|
|
72a0dc |
this._allowlistMap = new Map();
|
|
|
72a0dc |
|
|
|
72a0dc |
+ this._uninitializedNames = new Set(allowList);
|
|
|
72a0dc |
+ this._initializedPromise = new Promise(resolve => {
|
|
|
72a0dc |
+ this._resolveInitialized = resolve;
|
|
|
72a0dc |
+ });
|
|
|
72a0dc |
+
|
|
|
72a0dc |
this._watchList = allowList.map(name => {
|
|
|
72a0dc |
return Gio.DBus.watch_name(Gio.BusType.SESSION,
|
|
|
72a0dc |
name,
|
|
|
72a0dc |
Gio.BusNameWatcherFlags.NONE,
|
|
|
72a0dc |
- (conn_, name_, owner) => this._allowlistMap.set(name, owner),
|
|
|
72a0dc |
- () => this._allowlistMap.delete(name));
|
|
|
72a0dc |
+ (conn_, name_, owner) => {
|
|
|
72a0dc |
+ this._allowlistMap.set(name, owner);
|
|
|
72a0dc |
+ this._checkAndResolveInitialized(name);
|
|
|
72a0dc |
+ },
|
|
|
72a0dc |
+ () => {
|
|
|
72a0dc |
+ this._allowlistMap.delete(name);
|
|
|
72a0dc |
+ this._checkAndResolveInitialized(name);
|
|
|
72a0dc |
+ });
|
|
|
72a0dc |
});
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
/**
|
|
|
72a0dc |
+ * @param {string} name - bus name for which the watcher got initialized
|
|
|
72a0dc |
+ */
|
|
|
72a0dc |
+ _checkAndResolveInitialized(name) {
|
|
|
72a0dc |
+ if (this._uninitializedNames.delete(name) &&
|
|
|
72a0dc |
+ this._uninitializedNames.size === 0)
|
|
|
72a0dc |
+ this._resolveInitialized();
|
|
|
72a0dc |
+ }
|
|
|
72a0dc |
+
|
|
|
72a0dc |
+ /**
|
|
|
72a0dc |
+ * @async
|
|
|
72a0dc |
* @param {string} sender - the bus name that invoked the checked method
|
|
|
72a0dc |
* @returns {bool}
|
|
|
72a0dc |
*/
|
|
|
72a0dc |
- _isSenderAllowed(sender) {
|
|
|
72a0dc |
+ async _isSenderAllowed(sender) {
|
|
|
72a0dc |
+ await this._initializedPromise;
|
|
|
72a0dc |
return [...this._allowlistMap.values()].includes(sender);
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
@@ -507,15 +529,16 @@ var DBusSenderChecker = class {
|
|
|
72a0dc |
* Check whether the bus name that invoked @invocation maps
|
|
|
72a0dc |
* to an entry in the allow list.
|
|
|
72a0dc |
*
|
|
|
72a0dc |
+ * @async
|
|
|
72a0dc |
* @throws
|
|
|
72a0dc |
* @param {Gio.DBusMethodInvocation} invocation - the invocation
|
|
|
72a0dc |
* @returns {void}
|
|
|
72a0dc |
*/
|
|
|
72a0dc |
- checkInvocation(invocation) {
|
|
|
72a0dc |
+ async checkInvocation(invocation) {
|
|
|
72a0dc |
if (global.context.unsafe_mode)
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
|
|
|
72a0dc |
- if (this._isSenderAllowed(invocation.get_sender()))
|
|
|
72a0dc |
+ if (await this._isSenderAllowed(invocation.get_sender()))
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
|
|
|
72a0dc |
throw new GLib.Error(Gio.DBusError,
|
|
|
72a0dc |
diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js
|
|
|
72a0dc |
index ae1156f47..97fcfacd0 100644
|
|
|
72a0dc |
--- a/js/ui/screenshot.js
|
|
|
72a0dc |
+++ b/js/ui/screenshot.js
|
|
|
72a0dc |
@@ -37,7 +37,7 @@ var ScreenshotService = class {
|
|
|
72a0dc |
Gio.DBus.session.own_name('org.gnome.Shell.Screenshot', Gio.BusNameOwnerFlags.REPLACE, null, null);
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
- _createScreenshot(invocation, needsDisk = true, restrictCallers = true) {
|
|
|
72a0dc |
+ async _createScreenshot(invocation, needsDisk = true, restrictCallers = true) {
|
|
|
72a0dc |
let lockedDown = false;
|
|
|
72a0dc |
if (needsDisk)
|
|
|
72a0dc |
lockedDown = this._lockdownSettings.get_boolean('disable-save-to-disk');
|
|
|
72a0dc |
@@ -55,7 +55,7 @@ var ScreenshotService = class {
|
|
|
72a0dc |
return null;
|
|
|
72a0dc |
} else if (restrictCallers) {
|
|
|
72a0dc |
try {
|
|
|
72a0dc |
- this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ await this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
} catch (e) {
|
|
|
72a0dc |
invocation.return_gerror(e);
|
|
|
72a0dc |
return null;
|
|
|
72a0dc |
@@ -200,7 +200,7 @@ var ScreenshotService = class {
|
|
|
72a0dc |
"Invalid params");
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
}
|
|
|
72a0dc |
- let screenshot = this._createScreenshot(invocation);
|
|
|
72a0dc |
+ let screenshot = await this._createScreenshot(invocation);
|
|
|
72a0dc |
if (!screenshot)
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
|
|
|
72a0dc |
@@ -223,7 +223,7 @@ var ScreenshotService = class {
|
|
|
72a0dc |
|
|
|
72a0dc |
async ScreenshotWindowAsync(params, invocation) {
|
|
|
72a0dc |
let [includeFrame, includeCursor, flash, filename] = params;
|
|
|
72a0dc |
- let screenshot = this._createScreenshot(invocation);
|
|
|
72a0dc |
+ let screenshot = await this._createScreenshot(invocation);
|
|
|
72a0dc |
if (!screenshot)
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
|
|
|
72a0dc |
@@ -246,7 +246,7 @@ var ScreenshotService = class {
|
|
|
72a0dc |
|
|
|
72a0dc |
async ScreenshotAsync(params, invocation) {
|
|
|
72a0dc |
let [includeCursor, flash, filename] = params;
|
|
|
72a0dc |
- let screenshot = this._createScreenshot(invocation);
|
|
|
72a0dc |
+ let screenshot = await this._createScreenshot(invocation);
|
|
|
72a0dc |
if (!screenshot)
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
|
|
|
72a0dc |
@@ -269,7 +269,7 @@ var ScreenshotService = class {
|
|
|
72a0dc |
|
|
|
72a0dc |
async SelectAreaAsync(params, invocation) {
|
|
|
72a0dc |
try {
|
|
|
72a0dc |
- this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ await this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
} catch (e) {
|
|
|
72a0dc |
invocation.return_gerror(e);
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
@@ -289,9 +289,9 @@ var ScreenshotService = class {
|
|
|
72a0dc |
}
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
- FlashAreaAsync(params, invocation) {
|
|
|
72a0dc |
+ async FlashAreaAsync(params, invocation) {
|
|
|
72a0dc |
try {
|
|
|
72a0dc |
- this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ await this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
} catch (e) {
|
|
|
72a0dc |
invocation.return_gerror(e);
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
@@ -311,7 +311,7 @@ var ScreenshotService = class {
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
async PickColorAsync(params, invocation) {
|
|
|
72a0dc |
- const screenshot = this._createScreenshot(invocation, false, false);
|
|
|
72a0dc |
+ const screenshot = await this._createScreenshot(invocation, false, false);
|
|
|
72a0dc |
if (!screenshot)
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
|
|
|
72a0dc |
diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js
|
|
|
72a0dc |
index c511314f9..39bba7aa3 100644
|
|
|
72a0dc |
--- a/js/ui/shellDBus.js
|
|
|
72a0dc |
+++ b/js/ui/shellDBus.js
|
|
|
72a0dc |
@@ -81,13 +81,14 @@ var GnomeShell = class {
|
|
|
72a0dc |
/**
|
|
|
72a0dc |
* Focus the overview's search entry
|
|
|
72a0dc |
*
|
|
|
72a0dc |
+ * @async
|
|
|
72a0dc |
* @param {...any} params - method parameters
|
|
|
72a0dc |
* @param {Gio.DBusMethodInvocation} invocation - the invocation
|
|
|
72a0dc |
* @returns {void}
|
|
|
72a0dc |
*/
|
|
|
72a0dc |
- FocusSearchAsync(params, invocation) {
|
|
|
72a0dc |
+ async FocusSearchAsync(params, invocation) {
|
|
|
72a0dc |
try {
|
|
|
72a0dc |
- this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ await this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
} catch (e) {
|
|
|
72a0dc |
invocation.return_gerror(e);
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
@@ -100,13 +101,14 @@ var GnomeShell = class {
|
|
|
72a0dc |
/**
|
|
|
72a0dc |
* Show OSD with the specified parameters
|
|
|
72a0dc |
*
|
|
|
72a0dc |
+ * @async
|
|
|
72a0dc |
* @param {...any} params - method parameters
|
|
|
72a0dc |
* @param {Gio.DBusMethodInvocation} invocation - the invocation
|
|
|
72a0dc |
* @returns {void}
|
|
|
72a0dc |
*/
|
|
|
72a0dc |
- ShowOSDAsync([params], invocation) {
|
|
|
72a0dc |
+ async ShowOSDAsync([params], invocation) {
|
|
|
72a0dc |
try {
|
|
|
72a0dc |
- this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ await this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
} catch (e) {
|
|
|
72a0dc |
invocation.return_gerror(e);
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
@@ -143,9 +145,9 @@ var GnomeShell = class {
|
|
|
72a0dc |
* @param {Gio.DBusMethodInvocation} invocation - the invocation
|
|
|
72a0dc |
* @returns {void}
|
|
|
72a0dc |
*/
|
|
|
72a0dc |
- FocusAppAsync([id], invocation) {
|
|
|
72a0dc |
+ async FocusAppAsync([id], invocation) {
|
|
|
72a0dc |
try {
|
|
|
72a0dc |
- this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ await this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
} catch (e) {
|
|
|
72a0dc |
invocation.return_gerror(e);
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
@@ -167,13 +169,14 @@ var GnomeShell = class {
|
|
|
72a0dc |
/**
|
|
|
72a0dc |
* Show the overview's app grid
|
|
|
72a0dc |
*
|
|
|
72a0dc |
+ * @async
|
|
|
72a0dc |
* @param {...any} params - method parameters
|
|
|
72a0dc |
* @param {Gio.DBusMethodInvocation} invocation - the invocation
|
|
|
72a0dc |
* @returns {void}
|
|
|
72a0dc |
*/
|
|
|
72a0dc |
- ShowApplicationsAsync(params, invocation) {
|
|
|
72a0dc |
+ async ShowApplicationsAsync(params, invocation) {
|
|
|
72a0dc |
try {
|
|
|
72a0dc |
- this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ await this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
} catch (e) {
|
|
|
72a0dc |
invocation.return_gerror(e);
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
@@ -183,9 +186,9 @@ var GnomeShell = class {
|
|
|
72a0dc |
invocation.return_value(null);
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
- GrabAcceleratorAsync(params, invocation) {
|
|
|
72a0dc |
+ async GrabAcceleratorAsync(params, invocation) {
|
|
|
72a0dc |
try {
|
|
|
72a0dc |
- this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ await this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
} catch (e) {
|
|
|
72a0dc |
invocation.return_gerror(e);
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
@@ -197,9 +200,9 @@ var GnomeShell = class {
|
|
|
72a0dc |
invocation.return_value(GLib.Variant.new('(u)', [bindingAction]));
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
- GrabAcceleratorsAsync(params, invocation) {
|
|
|
72a0dc |
+ async GrabAcceleratorsAsync(params, invocation) {
|
|
|
72a0dc |
try {
|
|
|
72a0dc |
- this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ await this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
} catch (e) {
|
|
|
72a0dc |
invocation.return_gerror(e);
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
@@ -215,9 +218,9 @@ var GnomeShell = class {
|
|
|
72a0dc |
invocation.return_value(GLib.Variant.new('(au)', [bindingActions]));
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
- UngrabAcceleratorAsync(params, invocation) {
|
|
|
72a0dc |
+ async UngrabAcceleratorAsync(params, invocation) {
|
|
|
72a0dc |
try {
|
|
|
72a0dc |
- this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ await this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
} catch (e) {
|
|
|
72a0dc |
invocation.return_gerror(e);
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
@@ -230,9 +233,9 @@ var GnomeShell = class {
|
|
|
72a0dc |
invocation.return_value(GLib.Variant.new('(b)', [ungrabSucceeded]));
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
- UngrabAcceleratorsAsync(params, invocation) {
|
|
|
72a0dc |
+ async UngrabAcceleratorsAsync(params, invocation) {
|
|
|
72a0dc |
try {
|
|
|
72a0dc |
- this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ await this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
} catch (e) {
|
|
|
72a0dc |
invocation.return_gerror(e);
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
@@ -317,9 +320,9 @@ var GnomeShell = class {
|
|
|
72a0dc |
this._grabbers.delete(name);
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
- ShowMonitorLabelsAsync(params, invocation) {
|
|
|
72a0dc |
+ async ShowMonitorLabelsAsync(params, invocation) {
|
|
|
72a0dc |
try {
|
|
|
72a0dc |
- this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ await this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
} catch (e) {
|
|
|
72a0dc |
invocation.return_gerror(e);
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
@@ -331,9 +334,9 @@ var GnomeShell = class {
|
|
|
72a0dc |
invocation.return_value(null);
|
|
|
72a0dc |
}
|
|
|
72a0dc |
|
|
|
72a0dc |
- HideMonitorLabelsAsync(params, invocation) {
|
|
|
72a0dc |
+ async HideMonitorLabelsAsync(params, invocation) {
|
|
|
72a0dc |
try {
|
|
|
72a0dc |
- this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
+ await this._senderChecker.checkInvocation(invocation);
|
|
|
72a0dc |
} catch (e) {
|
|
|
72a0dc |
invocation.return_gerror(e);
|
|
|
72a0dc |
return;
|
|
|
72a0dc |
--
|
|
|
72a0dc |
2.35.1
|
|
|
72a0dc |
|