main: Warn when unsafe mode is toggled
MetaContext:unsafe-mode was added as a debugging tool to temporarily remove restrictions on privileged APIs. But as it turns out, there are now extensions that toggle the property permanently. Right now none of them are malicious (as far as I can see), but it's still a bad idea and should be discouraged. Do this with a notification that warns the user when unsafe mode is enabled non-interactively (i.e. via looking glass), and hopefully also clarifies what the weird lock icon in the top bar is about. https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4798 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2050>
This commit is contained in:
parent
254b0ca2ad
commit
aba0d0bb1b
@ -247,6 +247,23 @@ function _initializeUI() {
|
||||
|
||||
global.display.connect('gl-video-memory-purged', loadTheme);
|
||||
|
||||
global.context.connect('notify::unsafe-mode', () => {
|
||||
if (!global.context.unsafe_mode)
|
||||
return; // we're safe
|
||||
if (lookingGlass?.isOpen)
|
||||
return; // assume user action
|
||||
|
||||
const source = new MessageTray.SystemNotificationSource();
|
||||
messageTray.add(source);
|
||||
const notification = new MessageTray.Notification(source,
|
||||
_('System was put in unsafe mode'),
|
||||
_('Applications now have unrestricted access'));
|
||||
notification.addAction(_('Undo'),
|
||||
() => (global.context.unsafe_mode = false));
|
||||
notification.setTransient(true);
|
||||
source.showNotification(notification);
|
||||
});
|
||||
|
||||
// Provide the bus object for gnome-session to
|
||||
// initiate logouts.
|
||||
EndSessionDialog.init();
|
||||
|
Loading…
Reference in New Issue
Block a user