Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeePassXC doesn't emit a D-Bus PropertiesChanged events for Locked properties #11368

Open
m00nwtchr opened this issue Oct 15, 2024 · 5 comments

Comments

@m00nwtchr
Copy link

Overview

I'm trying to write a program that waits until the KeePassXC database is unlocked to perform XYZ actions.
But it seems that KeePassXC doesn't emit the events which would allow me to avoid manually checking the state via Get calls, even though emits-change is reported in D-Bus Introspection.

$ busctl --user introspect org.freedesktop.secrets /org/freedesktop/secrets/aliases/default
NAME                                TYPE      SIGNATURE      RESULT/VALUE FLAGS
org.freedesktop.DBus.Introspectable interface -              -            -
.Introspect                         method    -              s            -
org.freedesktop.DBus.Peer           interface -              -            -
.GetMachineId                       method    -              s            -
.Ping                               method    -              -            -
org.freedesktop.DBus.Properties     interface -              -            -
.Get                                method    ss             v            -
.GetAll                             method    s              a{sv}        -
.Set                                method    ssv            -            -
.PropertiesChanged                  signal    sa{sv}as       -            -
org.freedesktop.Secret.Collection   interface -              -            -
.CreateItem                         method    a{sv}(oayays)b oo           -
.Delete                             method    -              o            -
.SearchItems                        method    a{ss}          ao           -
.Created                            property  t              -            emits-change
.Items                              property  ao             0            emits-change
.Label                              property  s              "Passwords"  emits-change writable
.Locked                             property  b              true         emits-change
.Modified                           property  t              -            emits-change
.ItemChanged                        signal    o              -            -
.ItemCreated                        signal    o              -            -
.ItemDeleted                        signal    o              -            -

Steps to Reproduce

  • Run dbus-monitor --session "type='signal',path='/org/freedesktop/secrets/aliases/default'";
  • Lock/Unlock the database.
  • See that no PropertiesChanged signals are emitted.

Context

KeePassXC - Version 2.7.9
Revision: 8f6dd13

Operating System: Linux
Desktop Env: N/A
Window Manager: sway
Windowing System: Wayland

@michaelk83
Copy link

PropertiesChanged is not part of the Secret Service API spec. Unless it's required by some wider DBus API spec or standard.

@m00nwtchr
Copy link
Author

https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces

If one or more properties change on an object, the org.freedesktop.DBus.Properties.PropertiesChanged signal may be emitted (this signal was added in 0.14):

          org.freedesktop.DBus.Properties.PropertiesChanged (STRING interface_name,
                                                             ARRAY of DICT_ENTRY<STRING,VARIANT> changed_properties,
                                                             ARRAY<STRING> invalidated_properties);

where changed_properties is a dictionary containing the changed properties with the new values and invalidated_properties is an array of properties that changed but the value is not conveyed.

Whether the PropertiesChanged signal is supported can be determined by calling org.freedesktop.DBus.Introspectable.Introspect. Note that the signal may be supported for an object but it may differ how whether and how it is used on a per-property basis (for e.g. performance or security reasons). Each property (or the parent interface) must be annotated with the org.freedesktop.DBus.Property.EmitsChangedSignal annotation to convey this (usually the default value true is sufficient meaning that the annotation does not need to be used). See the section called “Introspection Data Format” for details on this annotation.

@michaelk83
Copy link

may be emitted

Doesn't look like a requirement.

I'm not saying it can't be implemented, but it's not something you can consistently rely on, especially if you want interoperability with other Secret Service providers.

In any case, don't expect it to be implemented soon. KeePassXC Secret Service code hasn't been touched in a while, and further updates are blocked by #8591.

@droidmonkey
Copy link
Member

I wonder why Qt doesn't emit the property changed message.

@m00nwtchr
Copy link
Author

m00nwtchr commented Oct 17, 2024

I'm not saying it can't be implemented, but it's not something you can consistently rely on, especially if you want interoperability with other Secret Service providers.

Currently I only really care about KeePassXC, but I can investigate the behaviour of other secret service providers if that would serve as a further incentive for implementing this.

In any case, don't expect it to be implemented soon. KeePassXC Secret Service code hasn't been touched in a while, and further updates are blocked by #8591.

Oh, that might be helpful to my project as well, so I'm fine with waiting, I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants