docker / docker/docker-credential-helpers

Inconsistent auth keys on macOS, Windows, Linux

Open
#256 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
1.3k
Forks
195
Avg merge
1d 20h
Merged PRs (30d)
5

Description

Steps to reproduce

  1. Authenticate to third party registries via the mechanism they recommend, i.e.:
# Amazon AWS Elastic Container Registry:
aws ecr get-login-password --region $region | docker login --username AWS --password-stdin $registryName

# Microsoft Azure Container Registry:
az acr login --name $registryName

# Google Cloud Container Registry
gcloud auth configure-docker

# GitHub Container Registry
echo $personalToken | docker login ghcr.io -u USERNAME --password-stdin
  1. Use either the Docker Go SDK or the credential helper CLI to output credential info

In Go:

func getCredentials() (map[string]clitypes.AuthConfig, error) {
	creds, err := config.Load(config.Dir())
	if err != nil {
		return nil, err
	}
	creds.CredentialsStore = credentials.DetectDefaultStore(creds.CredentialsStore)
	auths, err := creds.GetAllCredentials()
	if err != nil {
		return nil, err
	}
	return auths, nil
}

Via CLI:

docker-credential-desktop list
  1. Attempt to push an image by looking up the auth configuration in the map:
pushAuthConfig = authConfigs[registryServer]

authConfigBytes, err := json.Marshal(pushAuthConfig)
if err != nil {
	return "", nil, fmt.Errorf("error parsing authConfig: %v", err)
}
authConfigEncoded := base64.URLEncoding.EncodeToString(authConfigBytes)

pushOpts := types.ImagePushOptions{RegistryAuth: authConfigEncoded}

pushOutput, err := docker.ImagePush(ctx, img.Name, pushOpts)

Expected behavior

Auth configuration entries should be consistent across platforms, the push succeeds if the authentication is valid and present.

Actual behavior

On some platforms, all auth entries are prefixed with a scheme (https://), on others, only the legacy Docker registry server configuration is.

# macOS:
map[string]types.AuthConfig{
		"https://[redacted].dkr.ecr.us-west-2.amazonaws.com": ...
		"https://ghcr.io/": ...
		"https://index.docker.io/v1/": ...
		"https://registry-1.docker.io/": ...
		"https://[redacted].azurecr.io": ...
})

# Linux and Windows:
map[string]types.AuthConfig{
		"[redacted].dkr.ecr.us-west-2.amazonaws.com": ...
		"ghcr.io": ...
		"https://index.docker.io/v1/": ...
		"registry-1.docker.io": ...
		"[redacted].azurecr.io": ...
})

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Go credential-loading path using config.Load, credentials.DetectDefaultStore, and GetAllCredentials, then compare its output with docker-credential-desktop list across macOS, Linux, and Windows. Use the AWS, Azure, Google Cloud, and GitHub registry examples to reproduce the differing keys; done means equivalent valid registry credentials can be looked up consistently for image pushes on each platform.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.