After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 694107 - It is not possible to use SecretAttributes returned by a search to delete items.
It is not possible to use SecretAttributes returned by a search to delete items.
Status: RESOLVED FIXED
Product: libsecret
Classification: Other
Component: General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: libsecret maintainer(s)
libsecret maintainer(s)
Depends on:
Blocks: 679918
 
 
Reported: 2013-02-18 17:00 UTC by Claudio Saavedra
Modified: 2013-02-26 18:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
secret-attributes: improve validation of attributes table (1.62 KB, patch)
2013-02-19 09:06 UTC, Claudio Saavedra
none Details | Review
secret-attributes: improve validation of attributes table (4.03 KB, patch)
2013-02-26 15:23 UTC, Stef Walter
committed Details | Review

Description Claudio Saavedra 2013-02-18 17:00:38 UTC
After searching with secret_service_search() it is not possible to directly use other secret_service_* methods with the attributes of the matched items. This is because these might contain extra attributes (like xdg:schema or gkr:compat ones) that cause the internal validation of the secret service methods to fail.

It is possible to circumvent the issues with the xdg:schema attribute by checking that it is consistent with whatever schema is given, but for the rest I am not sure as to how to proceed. They could be ignored, in which case the validation would only care to ensure that the values are consistent, which might not be the ideal. Alternatively, users would have to rebuild the attributes table by copying only the items that belong to the given schema.

Another option is to ignore anything whose name has a form like [a-z]+:[a-z]+ and is presumably metadata and not an actual attribute.
Comment 1 Stef Walter 2013-02-18 19:21:51 UTC
(In reply to comment #0)
> After searching with secret_service_search() it is not possible to directly use
> other secret_service_* methods with the attributes of the matched items. This
> is because these might contain extra attributes (like xdg:schema or gkr:compat
> ones) that cause the internal validation of the secret service methods to fail.
> 
> It is possible to circumvent the issues with the xdg:schema attribute by
> checking that it is consistent with whatever schema is given, but for the rest
> I am not sure as to how to proceed. 

I would suggest doing validation on xdg:schema and skipping over 'gkr:compat:'. The former is necessary and a good approach. The latter would be more of a hack, but it's acceptable in this case given how ugly libgnome-keyring's use of the Secret Service API is. 

Did you say you would do a patch for this? LMK if you need anything else from me.
Comment 2 Claudio Saavedra 2013-02-18 20:21:39 UTC
Yes, i do. Are there other cases besides gkr:compat that need to be skipped? Hopefully not.
Comment 3 Stef Walter 2013-02-18 20:44:55 UTC
I don't think so:

libgnome-keyring$ git grep '"gkr:'
library/gnome-keyring.c:			if (g_str_has_prefix (name, "gkr:"))
library/gnome-keyring.c:			check = g_strdup_printf ("gkr:compat:uint32:%s", name);
library/gnome-keyring.c:			value = g_strdup_printf ("gkr:compat:uint32:%s", attr->name);
Comment 4 Claudio Saavedra 2013-02-19 09:06:00 UTC
Created attachment 236731 [details] [review]
secret-attributes: improve validation of attributes table

Attributes table that are built by the library itself contain
the xdg:schema meta-attribute. Additionally,
secrets with a SECRET_SCHEMA_COMPAT_NETWORK schema might also have
GNOME Keyring specific meta-attributes (prefixed 'gkr'). During
validation, ensure that the former is consistent with the name
of the schema and ignore the latter.
Comment 5 Claudio Saavedra 2013-02-26 14:02:49 UTC
Stef? We need this for ephy 3.8.
Comment 6 Stef Walter 2013-02-26 15:23:50 UTC
Created attachment 237452 [details] [review]
secret-attributes: improve validation of attributes table

I've added tests. Could you review the tests, and once that's done I'll push.
Comment 7 Claudio Saavedra 2013-02-26 16:56:31 UTC
Tests look good. Thanks for adding them!
Comment 8 Claudio Saavedra 2013-02-26 16:57:29 UTC
Hm, perhaps you should free the tables, though..
Comment 9 Stef Walter 2013-02-26 18:31:50 UTC
Done and pushed.

Attachment 237452 [details] pushed as 261749e - secret-attributes: improve validation of attributes table