[gnome-shell/gnome-3-34] introspect: Fix whitelist check



commit 334762ee9e41fd461e8c828b84757db793e1a399
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Nov 25 18:44:10 2019 +0000

    introspect: Fix whitelist check
    
    The whitelist is a list of well-known D-Bus names, which we then search
    for the unique name we get from the method invocation - unsuccesfully.
    
    Fix this by watching the bus for any name in the whitelist in order
    to maintain a map from wel-known to unique name that we can use for
    matching.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/1916
    
    
    (cherry picked from commit eee1ab48903b83cef18cd85131436c0e1f987513)

 js/misc/introspect.js | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/js/misc/introspect.js b/js/misc/introspect.js
index f256555cb8..f99ea84e90 100644
--- a/js/misc/introspect.js
+++ b/js/misc/introspect.js
@@ -40,6 +40,15 @@ var IntrospectService = class {
                         });
 
         this._syncRunningApplications();
+
+        this._whitelistMap = new Map();
+        APP_WHITELIST.forEach(appName => {
+            Gio.DBus.watch_name(Gio.BusType.SESSION,
+                appName,
+                Gio.BusNameWatcherFlags.NONE,
+                (conn, name, owner) => this._whitelistMap.set(name, owner),
+                (conn, name) => this._whitelistMap.delete(name));
+        });
     }
 
     _isStandaloneApp(app) {
@@ -51,7 +60,7 @@ var IntrospectService = class {
     }
 
     _isSenderWhitelisted(sender) {
-        return APP_WHITELIST.includes(sender);
+        return [...this._whitelistMap.values()].includes(sender);
     }
 
     _getSandboxedAppId(app) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]