Skip to content

Commit e7bd395

Browse files
committed
osxkeychain: store: add atyp attribute
Prior to v0.9.0, the osxkeychain creds helper was adding the `atyp` attribute (ie. authentication type) to its credentials. It was also specifying this attribute when querying the keychain for credentials. Since v0.9.0, we don't set this attribute anymore. So, if a credential is stored with v0.9.0+ and then queried with a v0.8.2 helper, the atyp attribute will be missing and the credential won't be found. Signed-off-by: Albin Kerouanton <[email protected]>
1 parent cfd6d21 commit e7bd395

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

osxkeychain/osxkeychain.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ func (h Osxkeychain) Add(creds *credentials.Credentials) error {
4646
item.SetLabel(credentials.CredsLabel)
4747
item.SetAccount(creds.Username)
4848
item.SetData([]byte(creds.Secret))
49+
// Prior to v0.9, the credential helper was searching for credentials with
50+
// the "dflt" authentication type (see [1]). Since v0.9.0, Get doesn't use
51+
// that attribute anymore, and v0.9.0 - v0.9.2 were not setting it here
52+
// either.
53+
//
54+
// In order to keep compatibility with older versions, we need to store
55+
// credentials with this attribute set. This way, credentials stored with
56+
// newer versions can be retrieved by older versions.
57+
//
58+
// [1]: https://github.com/docker/docker-credential-helpers/blob/v0.8.2/osxkeychain/osxkeychain.c#L66
59+
item.SetAuthenticationType("dflt")
4960
if err := splitServer(creds.ServerURL, item); err != nil {
5061
return err
5162
}

0 commit comments

Comments
 (0)