screenshot: Unrestrict PickColor

Commit dd2cd6286c restricted callers of the screenshot methods to
portal implementations, gnome-settings-daemon and gnome-screenshot.

That restriction does make sense for the actual screenshot methods,
but `PickColor` is actually used by GTK in its color picker (and
therefore may be called from arbitrary applications).

Fix this by unrestricting access to `PickColor` again. Considering that
the method is always interactive, it's not very privacy/security-sensitive
anyway.

https://gitlab.gnome.org/GNOME/gtk/-/issues/4283

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1990>
This commit is contained in:
Florian Müllner 2021-09-25 14:15:32 +02:00 committed by Marge Bot
parent 82e16a206f
commit a3dcdaae30

View File

@ -37,7 +37,7 @@ var ScreenshotService = class {
Gio.DBus.session.own_name('org.gnome.Shell.Screenshot', Gio.BusNameOwnerFlags.REPLACE, null, null); Gio.DBus.session.own_name('org.gnome.Shell.Screenshot', Gio.BusNameOwnerFlags.REPLACE, null, null);
} }
_createScreenshot(invocation, needsDisk = true) { _createScreenshot(invocation, needsDisk = true, restrictCallers = true) {
let lockedDown = false; let lockedDown = false;
if (needsDisk) if (needsDisk)
lockedDown = this._lockdownSettings.get_boolean('disable-save-to-disk'); lockedDown = this._lockdownSettings.get_boolean('disable-save-to-disk');
@ -53,7 +53,7 @@ var ScreenshotService = class {
Gio.IOErrorEnum, Gio.IOErrorEnum.PERMISSION_DENIED, Gio.IOErrorEnum, Gio.IOErrorEnum.PERMISSION_DENIED,
'Saving to disk is disabled'); 'Saving to disk is disabled');
return null; return null;
} else { } else if (restrictCallers) {
try { try {
this._senderChecker.checkInvocation(invocation); this._senderChecker.checkInvocation(invocation);
} catch (e) { } catch (e) {
@ -311,7 +311,7 @@ var ScreenshotService = class {
} }
async PickColorAsync(params, invocation) { async PickColorAsync(params, invocation) {
const screenshot = this._createScreenshot(invocation, false); const screenshot = this._createScreenshot(invocation, false, false);
if (!screenshot) if (!screenshot)
return; return;