registry auth fallback bugfix#672
Merged
Merged
Conversation
Signed-off-by: Adam Martin <adam.martin@ranchergovernment.com>
Contributor
Author
|
@Mergifyio backport release/2.0 |
✅ Backports have been createdDetails
Cherry-pick of 6f5d767 has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
3 tasks
amartin120
added a commit
that referenced
this pull request
Jul 21, 2026
Signed-off-by: Adam Martin <adam.martin@ranchergovernment.com> (cherry picked from commit 6f5d767)
amartin120
added a commit
that referenced
this pull request
Jul 21, 2026
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.
Please check below, if the PR fulfills these requirements:
Associated Links:
Types of Changes:
Proposed Changes:
Fixes registry credential resolution during
hauler store copy registry://,add, andsyncwhen running in environments without a $HOME or $DOCKER_CONFIG set.hauler loginhas a fallback for this but go-containerregistry doesn't inherently look in the fallback location.pkg/content/dockerconfig.go(new): AddsSetDefaultDockerConfig(), which defaults$DOCKER_CONFIGto the same directoryhauler loginwrites to (<home>/.docker) so go-containerregistry'sDefaultKeychaincan find credentials even when$HOMEis unset. Replicates docker/cli'sconfig.Dir()/getHomeDir()resolution — including the/etc/passwdfallback viaos/user.Current()— using only the standard library. An explicitly setDOCKER_CONFIGalways wins.cmd/hauler/cli/cli.go: InvokesSetDefaultDockerConfig()in the rootPersistentPreRun, logging the defaulted path at debug level.pkg/content/registry.go: Stops silently swallowing credential-resolution failures. Registry host parse errors, keychain resolve errors, and authorization read errors now return wrapped errors instead of falling back to anonymous auth; only a genuineAnonymousresult yields empty credentials.Verification/Testing of Changes:
hauler login <registry>and$HOMEunset, runhauler store copy registry://<registry>/...and confirm the push authenticates instead of failing anonymously.--log-level debugand confirm thedefaulted $DOCKER_CONFIG to [...]line appears.$DOCKER_CONFIGis left unchanged.Additional Context:
Small, targeted bugfix. The previous code returned anonymous credentials on any resolution error, masking real auth failures; this makes credential lookup match
hauler login's write location and surfaces genuine errors.