Protocol should not be stripped out of the registry URL on login
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 2.2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
Description
When a user provides a registry URL to authenticate through docker login, we currently strip the protocol:
https://github.com/docker/cli/blob/master/cli/command/registry.go#L85
Change has been introduced in: https://github.com/moby/moby/commit/67d752ac55869eab42280947ad37ff5e1468d458 but I can't see the purpose.
Implementation of ConvertToHostname is here: https://github.com/moby/moby/blob/8874f80e67c560f44322233bfc22ecd86b85e9e2/registry/auth.go#L212
All these commands are treated the same way on the credentials-storing level:
> docker login https://foo.bar
> docker login http://foo.bar
> docker login foo.bar
And docker currently appends an "http" after stripping the protocol, which is not okay at all.
Decisions to store them as HTTP or HTTPS should not be done by the underlying docker-credential-helpers API.
This needs to be fixed very soon as we made the decision to default to HTTPS when no protocol is present and that happens when you specify docker login http://foo.bar too..
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in cli/command/registry.go around the docker login registry URL handling, then read ConvertToHostname in registry/auth.go and the linked credential-helper behavior. Reproduce the three docker login forms and verify that explicit http and https protocols are preserved while an omitted protocol follows the default HTTPS behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- authentication, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100