Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions osxkeychain/osxkeychain.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ func (h Osxkeychain) Add(creds *credentials.Credentials) error {
item.SetLabel(credentials.CredsLabel)
item.SetAccount(creds.Username)
item.SetData([]byte(creds.Secret))
// Prior to v0.9, the credential helper was searching for credentials with
// the "dflt" authentication type (see [1]). Since v0.9.0, Get doesn't use
// that attribute anymore, and v0.9.0 - v0.9.2 were not setting it here
// either.
//
// In order to keep compatibility with older versions, we need to store
// credentials with this attribute set. This way, credentials stored with
// newer versions can be retrieved by older versions.
//
// [1]: https://github.com/docker/docker-credential-helpers/blob/v0.8.2/osxkeychain/osxkeychain.c#L66
item.SetAuthenticationType("dflt")
Copy link
Member Author

@akerouanton akerouanton Mar 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a follow-up, it'd be great to add this constant and the ones I hardcoded in #361 to keybase/go-keychain.

I started doing that, but it's lower priority than getting this fixed here before we release the next version of Docker Desktop with a creds store that doesn't support downgrades.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum yes indeed I looked at previous implem https://github.com/docker/docker-credential-helpers/pull/282/files#diff-13e5d0d1bee45d43439783edc43138e1d9584d2ec29cab4969460384db72ec42L28 and we set it to dflt as well.

I thought dflt was the default SecAuthenticationType in keybase/go-keychain so agree to set this upstream.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! I forgot to add a link to keychain_get in my comment. Let me update it before I merge.

if err := splitServer(creds.ServerURL, item); err != nil {
return err
}
Expand Down