From bbcc8b141c9538bb97963ab257d20023d82a2d1b Mon Sep 17 00:00:00 2001 From: JakobDev Date: Fri, 10 Jun 2022 12:08:19 +0200 Subject: [PATCH] Save only valid D-Bus Names --- src/models/sessionBus.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/models/sessionBus.js b/src/models/sessionBus.js index 2f32b537..63d843e3 100644 --- a/src/models/sessionBus.js +++ b/src/models/sessionBus.js @@ -23,12 +23,15 @@ const {GObject} = imports.gi; const {FlatpakSharedModel} = imports.models.shared; const {FlatsealOverrideStatus} = imports.models.overrideStatus; +/* https://dbus.freedesktop.org/doc/dbus-specification.html */ +const EXP = /^(([A-Z]|[a-z]|[0-9]|_|-)+)(\.(([A-Z]|[a-z]|[0-9]|_|-)+))+(\.\*){0,1}$/; var FlatpakSessionBusModel = GObject.registerClass({ GTypeName: 'FlatpakSessionBusModel', }, class FlatpakSessionBusModel extends FlatpakSharedModel { _init() { super._init({}); + this._expression = new RegExp(EXP); } getPermissions() { @@ -180,7 +183,9 @@ var FlatpakSessionBusModel = GObject.registerClass({ saveToKeyFile(keyFile) { const group = this.constructor.getGroup(); Object.entries(this._overrides).forEach(([key, value]) => { - keyFile.set_value(group, key, value); + if (this._expression.test(key)) { + keyFile.set_value(group, key, value); + } }); }