18fbde
From d90d7e22143949d59880981fe53adcfad27a5fd3 Mon Sep 17 00:00:00 2001
18fbde
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
18fbde
Date: Wed, 23 Jan 2019 23:55:12 +0100
18fbde
Subject: [PATCH 1/2] panel: Don't allow opening hidden menus via keybindings
18fbde
18fbde
We shouldn't allow toggling menus that aren't supported by the
18fbde
current session mode, but as indicators are hidden rather than
18fbde
destroyed on mode switches, it is not enough to check for an
18fbde
indicator's existence.
18fbde
18fbde
https://gitlab.gnome.org/GNOME/gnome-shell/issues/851
18fbde
---
18fbde
 js/ui/panel.js | 4 ++--
18fbde
 1 file changed, 2 insertions(+), 2 deletions(-)
18fbde
18fbde
diff --git a/js/ui/panel.js b/js/ui/panel.js
18fbde
index 2f593247d..02667f92f 100644
18fbde
--- a/js/ui/panel.js
18fbde
+++ b/js/ui/panel.js
18fbde
@@ -985,8 +985,8 @@ var Panel = new Lang.Class({
18fbde
     },
18fbde
 
18fbde
     _toggleMenu(indicator) {
18fbde
-        if (!indicator) // menu not supported by current session mode
18fbde
-            return;
18fbde
+        if (!indicator || !indicator.container.visible)
18fbde
+            return; // menu not supported by current session mode
18fbde
 
18fbde
         let menu = indicator.menu;
18fbde
         if (!indicator.actor.reactive)
18fbde
-- 
18fbde
2.23.0
18fbde
18fbde
18fbde
From 5083ad899c976f7221848500fc9d4bb393a66327 Mon Sep 17 00:00:00 2001
18fbde
From: Ray Strode <rstrode@redhat.com>
18fbde
Date: Wed, 23 Jan 2019 15:59:42 -0500
18fbde
Subject: [PATCH 2/2] shellActionModes: disable POPUP keybindings in unlock
18fbde
 screen
18fbde
18fbde
Certain keybindings should continue to work even when a popup
18fbde
menu is on screen. For instance, the keybinding for showing
18fbde
the app menu and the keyinding for showing the calendar are
18fbde
examples.
18fbde
18fbde
This is achieved by putting in place a special "POPUP" action
18fbde
mode, whenever a popup menu is active.  This mode replaces
18fbde
the (e.g., "NORMAL" or "OVERVIEW") action mode that was in place
18fbde
for as long as the popup menu is active.
18fbde
18fbde
But those keybindings should not work when the user is at the
18fbde
unlock dialog (which uses an action mode of "UNLOCK").
18fbde
18fbde
Unfortunately, since commit c79d24b6 they do.
18fbde
18fbde
This commit addresses the problem by forcing the action mode
18fbde
to NONE at the unlock screen when popups are visible.
18fbde
18fbde
CVE-2019-3820
18fbde
18fbde
Closes https://gitlab.gnome.org/GNOME/gnome-shell/issues/851
18fbde
---
18fbde
 js/gdm/authPrompt.js  | 3 ++-
18fbde
 js/gdm/loginDialog.js | 3 ++-
18fbde
 js/ui/shellEntry.js   | 6 ++++--
18fbde
 3 files changed, 8 insertions(+), 4 deletions(-)
18fbde
18fbde
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
18fbde
index 27a55246a..15d3273fa 100644
18fbde
--- a/js/gdm/authPrompt.js
18fbde
+++ b/js/gdm/authPrompt.js
18fbde
@@ -14,6 +14,7 @@ const Batch = imports.gdm.batch;
18fbde
 const GdmUtil = imports.gdm.util;
18fbde
 const Meta = imports.gi.Meta;
18fbde
 const Params = imports.misc.params;
18fbde
+const Shell = imports.gi.Shell;
18fbde
 const ShellEntry = imports.ui.shellEntry;
18fbde
 const Tweener = imports.ui.tweener;
18fbde
 const UserWidget = imports.ui.userWidget;
18fbde
@@ -110,7 +111,7 @@ var AuthPrompt = new Lang.Class({
18fbde
                          x_align: St.Align.START });
18fbde
         this._entry = new St.Entry({ style_class: 'login-dialog-prompt-entry',
18fbde
                                      can_focus: true });
18fbde
-        ShellEntry.addContextMenu(this._entry, { isPassword: true });
18fbde
+        ShellEntry.addContextMenu(this._entry, { isPassword: true, actionMode: Shell.ActionMode.NONE });
18fbde
 
18fbde
         this.actor.add(this._entry,
18fbde
                        { expand: true,
18fbde
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
18fbde
index 912c0e0ca..141ed9265 100644
18fbde
--- a/js/gdm/loginDialog.js
18fbde
+++ b/js/gdm/loginDialog.js
18fbde
@@ -338,7 +338,8 @@ var SessionMenuButton = new Lang.Class({
18fbde
                  this._button.remove_style_pseudo_class('active');
18fbde
         });
18fbde
 
18fbde
-        this._manager = new PopupMenu.PopupMenuManager({ actor: this._button });
18fbde
+        this._manager = new PopupMenu.PopupMenuManager({ actor: this._button },
18fbde
+                                                       { actionMode: Shell.ActionMode.NONE });
18fbde
         this._manager.addMenu(this._menu);
18fbde
 
18fbde
         this._button.connect('clicked', () => { this._menu.toggle(); });
18fbde
diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js
18fbde
index 72e2fc33b..6d46a0997 100644
18fbde
--- a/js/ui/shellEntry.js
18fbde
+++ b/js/ui/shellEntry.js
18fbde
@@ -10,6 +10,7 @@ const BoxPointer = imports.ui.boxpointer;
18fbde
 const Main = imports.ui.main;
18fbde
 const Params = imports.misc.params;
18fbde
 const PopupMenu = imports.ui.popupMenu;
18fbde
+const Shell = imports.gi.Shell;
18fbde
 
18fbde
 const LOCKDOWN_SCHEMA = 'org.gnome.desktop.lockdown';
18fbde
 const DISABLE_SHOW_PASSWORD_KEY = 'disable-show-password';
18fbde
@@ -171,11 +172,12 @@ function addContextMenu(entry, params) {
18fbde
     if (entry.menu)
18fbde
         return;
18fbde
 
18fbde
-    params = Params.parse (params, { isPassword: false });
18fbde
+    params = Params.parse (params, { isPassword: false, actionMode: Shell.ActionMode.POPUP });
18fbde
 
18fbde
     entry.menu = new EntryMenu(entry);
18fbde
     entry.menu.isPassword = params.isPassword;
18fbde
-    entry._menuManager = new PopupMenu.PopupMenuManager({ actor: entry });
18fbde
+    entry._menuManager = new PopupMenu.PopupMenuManager({ actor: entry },
18fbde
+                                                        { actionMode: params.actionMode });
18fbde
     entry._menuManager.addMenu(entry.menu);
18fbde
 
18fbde
     // Add an event handler to both the entry and its clutter_text; the former
18fbde
-- 
18fbde
2.23.0
18fbde