Skip to content

More robust data handling in svc.GetAllCollections()? #3

Description

@ryanerwin

First off, thanks so much for writing this library! I can see that a lot of work went into it and the code looks very well organized. Thanks for this fantastic contribution to the community!

I saw there were some other go keychain interfaces, but I was not able to get good results out of my tests of each one. Yours is a very good, I think nearly complete, implementation! Nice work!

Describe the bug

	conn, _ := dbus.SessionBus()
	svc, _ := keyring.GetSecretService(conn)
	session, _ := svc.OpenSession()
	collection, _ := svc.GetAllCollections()

On one system that I tested, GetAllCollections() requires that every item added to the collections Array is tested with i.GetLabel();.

Just by commenting out the GetLabel block in item.go I was able to get an otherwise usable list back from GetAllCollections().

go-dbus-keyring/item.go

Lines 73 to 75 in a068717

if _, err := i.GetLabel(); err != nil {
return nil, err
}

I suspect that it's a data corruption issue, and that's why I used the question more robust data handling?

I think that more robust data handling in this function makes sense, because GetAllCollections is returning you the entire collection list. Even if there is a problem with a single element in the list, isn't it better to push that error handling later in the process?

To Reproduce
I'm not sure how to help you reproduce this without transferring the entire ~/.local/keychain folder over to you...

Expected behaviour
I would prefer that an error on an array element in the GetAllCollections() would not zero out the entire collections array, even if some err value is returned.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • keyring-server: gnome-keyring
  • desktop-environment: gnome
  • Ubuntu 20.04

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions