Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notation login fails to detect existing credentials for docker.io #697

Closed
Wwwsylvia opened this issue May 31, 2023 · 0 comments · Fixed by #703
Closed

notation login fails to detect existing credentials for docker.io #697

Wwwsylvia opened this issue May 31, 2023 · 0 comments · Fixed by #703
Labels
bug Something isn't working triage Need to triage

Comments

@Wwwsylvia
Copy link
Contributor

Wwwsylvia commented May 31, 2023

What is the areas you experience the issue in?

Notation CLI

What is not working as expected?

On a machine without credentials store, after docker login docker.io succeeds, notation login with the same credential should also succeed with a warning.
image

However, it fails to detect the existing credential and throws an error:
image

The bug is at here:

if savedCred, err := credsStore.Get(ctx, registryName); err != nil || savedCred != cred {
if err != nil {
// if we fail to get the saved credential, log a warning
// but do not throw the GET error, as the error could be
// confusing to users
logger := log.GetLogger(ctx)
logger.Warnf("Failed to get the existing credentials for %s: %v", registryName, err)
}
return fmt.Errorf("failed to log in to %s: the credential could not be saved because a credentials store is required to securely store the password. See %s",
registryName, urlDocHowToAuthenticate)
}

where credsStore.Get() attempts to get the credential for docker.io, while the credential for docker.io is stored in the entry https://index.docker.io/v1/ (expected behavior), hence credsStore.Get("docker.io") returns an empty credential savedCred that does not match the provided credential cred.

A mapping from docker.io to https://index.docker.io/v1/ is required.

What did you expect to happen?

notation login should be able to detect the existing credentials for docker.io

Expected output:
image

How can we reproduce it?

On a machine without credentials store,

  1. Run
docker login docker.io -u $username -p $password
  1. Then run
notation login docker.io -u $username -p $password

Describe your environment

Windows 11/powershell

What is the version of your Notation CLI or Notation Library?

Version: 1.0.0-rc.7
Go version: go1.20.4
Git commit: ebfb9ef

@Wwwsylvia Wwwsylvia added bug Something isn't working triage Need to triage labels May 31, 2023
shizhMSFT pushed a commit that referenced this issue Jun 6, 2023
Fixes #697

Signed-off-by: Sylvia Lei <lixlei@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Need to triage
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant