login: warn when the server address contains an explicit scheme - #5169
Open
locker95 wants to merge 1 commit into
Open
login: warn when the server address contains an explicit scheme#5169locker95 wants to merge 1 commit into
locker95 wants to merge 1 commit into
Conversation
`nerdctl login` accepts a server address with an explicit scheme (e.g. `https://index.docker.io/v1/`) only as a convenience: the scheme is silently disregarded and connections are made over https regardless, which is surprising when the user asked for `http://`. Warn the user that the scheme is ignored, and point at the global --insecure-registry flag when plain http was requested. Credential lookup paths reusing dockerconfigresolver.Parse (pull/push) are intentionally left silent. Fixes containerd#3052 Signed-off-by: Dean Chen <862469039@qq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3052.
As noted by @fahedouch in the issue ("It looks like a bug. It is not the intended behavior."),
nerdctl loginsilently drops an explicit scheme from the server address. Following the direction suggested by @apostasie, this change warns the user that this syntax is only supported as a convenience and that the scheme is ignored; whenhttp://was requested, the warning additionally points at the global--insecure-registryflag. The warning is emitted only from thelogincode path —dockerconfigresolver.Parseis untouched, so credential lookup during pull/push stays silent.Testing: a platform-independent unit test covers the new detection helper (verified locally on macOS);
TestLoginAgainstVariantsnow also asserts the warning on stderr for the scheme variants. I could only compile-verify the Linux integration test locally (GOOS=linux go build ./.../go vet/go test -c), so I am relying on CI to exercise it.This patch was developed with the assistance of an AI tool (Claude); I have reviewed and tested the change and take responsibility for it.