fix: surface HTTP fallback error when HTTPS registry login fails#6882
Open
vatsalgargg wants to merge 1 commit intodocker:masterfrom
Open
fix: surface HTTP fallback error when HTTPS registry login fails#6882vatsalgargg wants to merge 1 commit intodocker:masterfrom
vatsalgargg wants to merge 1 commit intodocker:masterfrom
Conversation
Signed-off-by: vatsalgargg <vatsalg80@gmail.com>
Author
|
Hi team, Just submitting this fix for #5253. It ensures the CLI doesn't swallow the original TLS/HTTPS failure when the daemon falls back to HTTP for insecure registries. Tested locally via make cross. Let me know if you'd like any adjustments to the error string or if you need me to add any specific unit tests for this! |
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.
- What I did
Fixes #5253. I fixed an error-masking issue in
docker loginwhere the CLI would swallow the initial HTTPS connection failure and only surface the subsequent HTTP fallback error when communicating with an insecure registry.- How I did it
I modified the error handling logic in
cli/command/registry/login.go. The patch intercepts the error returned by the daemon, checking if the user explicitly requested anhttps://prefix and if the resulting error string contains anhttp://failure (indicating a protocol downgrade). If both conditions are met, it wraps the error usingfmt.Errorfto explicitly inform the user that their requested HTTPS connection failed and the daemon was rejected after falling back to HTTP.- How to verify it
insecure-registriesentry pointing to a registry that rejects plaintext HTTP traffic (e.g., a Harbor instance throwing 403s on port 80).docker login https://<registry-ip>403 ForbiddenHTTP error for an HTTPS request.- Human readable description for the release notes