gnome-keyring secret-tool weird behaviour



If I have a locked collection and try the command:

>secret-tool search notes 5

The string 'notes' is an attribute name I've been using on some custom schema items I've been storing on the keyring, 5 is a test value that exists in the keyring. I get this output:

--------
[/org/freedesktop/secrets/collection/passman/2]
label =
secret =
created =
modified =
schema = org.freedesktop.Secret.Generic
attribute.gkr:compat:hashed:xdg:schema = a60a3a24ba9e65bb2db0379253f8a5fa
attribute.gkr:compat:hashed:notes = e4da3b7fbbce2345d7772b0674a318d5
attribute.gkr:compat:hashed:logo = d41d8cd98f00b204e9800998ecf8427e
--------

It was expected, the collection was locked. Now if I add the --unlock flag, I would expect all fields to be shown, instead I get this output.

--------
[/org/freedesktop/secrets/collection/passman/2]
label =
secret = 4
created =
modified =
schema = org.freedesktop.Secret.Generic
attribute.gkr:compat:hashed:xdg:schema = a60a3a24ba9e65bb2db0379253f8a5fa
attribute.gkr:compat:hashed:notes = e4da3b7fbbce2345d7772b0674a318d5
attribute.gkr:compat:hashed:logo = d41d8cd98f00b204e9800998ecf8427e
--------

Note the secret value is now shown, the rest though is still empty. However if I run again either the first command, without the --unlock flag, or the second command, with the --unlock flag, I get this output.

--------
[/org/freedesktop/secrets/collection/passman/2]
label = 2:3
secret = 4
created = 2015-11-03 08:18:24
modified = 2015-11-03 08:18:24
schema = com.idlecore.passman.schema
attribute.logo =
attribute.notes = 5
--------

The way I see it, I need to run the command again after unlocking the collection. This was to me a difficult behaviour to detect because after the fields are loaded for the first time, then they load every time. I had to log in and out of my account to recreate these conditions for every test, maybe there is a better way, I couldn't find out.

Also I wasn't even using the secret-tool before, I was coding a little GUI application with libsecret and came across this behaviour, I couldn't tell what was wrong from the documentation so I tried looking at the secret-tool's source code. Only to detect no differences and later realize the tool actually behaves in the same way.

Seahorse uses libsecret, when I unlock a collection for the first time using the GUI, it is able to display every field. I was a bit lost inside their source repo though and couldn't find the relevant part of the code.

This replicates the issue for me, using python3.4 and libsecret 0.18.2. I need to log out and back in for each test. I use here a custom collection not to mess with my default one, collections[2]. This little piece of code only works the second time I run it.

from gi.repository import Secret
service = Secret.Service.get_sync(Secret.ServiceFlags.LOAD_COLLECTIONS)
collections = service.get_collections()
unlocked_collection = service.unlock_sync([collections[2]], None)[1][0]
unlocked_collection.get_items()[0].get_label()

Would appreciate some help.


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