Conversation
| 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}$/; |
There was a problem hiding this comment.
- hyphens are not allowed
- regex can be simplified (
([A-Z]|[a-z])->([A-Za-z])) - names must not start with an digit
| const EXP = /^(([A-Z]|[a-z]|[0-9]|_|-)+)(\.(([A-Z]|[a-z]|[0-9]|_|-)+))+(\.\*){0,1}$/; | |
| const EXP = /^([A-Za-z_][A-Za-z0-9_]+)(\.[A-Za-z_][A-Za-z0-9_]+)+(\.\*)?$/; |
(untested suggestion)
There was a problem hiding this comment.
This RegEx is not from me. It is already used in Flatseal.
Flatseal/src/widgets/busNameRow.js
Lines 27 to 28 in 562ddec
It is used to display the valid icon in the D-Bus edit field. If it is wrong, it should be fixed in both places.
There was a problem hiding this comment.
hypens are allowed, but just on the last segment of the name
| const group = this.constructor.getGroup(); | ||
| Object.entries(this._overrides).forEach(([key, value]) => { | ||
| keyFile.set_value(group, key, value); | ||
| if (this._expression.test(key)) { |
There was a problem hiding this comment.
For consistency, instead of doing this here, can you move this to updateFromProxyProperty? Like I do it here https://github.com/tchx84/Flatseal/blob/master/src/models/variables.js#L86
| 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}$/; |
There was a problem hiding this comment.
To make this better than I currently do it, how about we officially move the definition of this esoteric regexp to this model (e.g. var BUS_NAME_REGEX = ...), and then we import this constant here https://github.com/tchx84/Flatseal/blob/master/src/widgets/busNameRow.js#L28 (instead of duplicating it)
Flatpak has a Bug that Apps didn't start when you give them Permission to talk to a invalid D-Dbus name (flatpak/flatpak#4940). Until this is fixed, it is better to block writing invalid D-Bus names. If someone does accidental use a invalid D-Bus name for global and ignore the warning, no Flatpak App will start until the problem is solved with the Flatpak cli or the overrides file is deleted.