-
Notifications
You must be signed in to change notification settings - Fork 91
Description
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.

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

The bug is at here:
notation/cmd/notation/login.go
Lines 118 to 128 in ebfb9ef
| 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
How can we reproduce it?
On a machine without credentials store,
- Run
docker login docker.io -u $username -p $password- Then run
notation login docker.io -u $username -p $passwordDescribe 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
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
