restore anonymous registry pulls:#183
Merged
Merged
Conversation
The resolver setup only installed an Authorizer when registry credentials were supplied. Without an authorizer the docker resolver has no way to answer a Bearer-token challenge, so anonymous pulls from registries that always challenge (e.g. ghcr.io, even for public images) fail with 401 on the first HEAD request. The previous code worked because docker.NewResolver synthesised a default authorizer with nil creds, which still performs the unauthenticated token exchange. Always install a docker authorizer and only attach the credential callback when both username and password are set. Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes anonymous pulls from registries that always issue a Bearer-token challenge (e.g., ghcr.io), by ensuring the Docker resolver is always configured with an authorizer (even when no registry credentials are provided).
Changes:
- Always install a
dockerauthorizer so Bearer-token challenges can be answered for anonymous pulls. - Only attach the credential callback to the authorizer when both
registryUsernameandregistryPasswordare set.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Merge Queue Status
This pull request spent 4 minutes 3 seconds in the queue, including 3 minutes 25 seconds running CI. Required conditions to merge
|
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.
Description
The resolver setup only installed an Authorizer when registry credentials were supplied. Without an authorizer the docker resolver has no way to answer a Bearer-token challenge, so anonymous pulls from registries that always challenge (e.g. ghcr.io, even for public images) fail with 401 on the first HEAD request. The previous code worked because docker.NewResolver synthesized a default authorizer with nil creds, which still performs the unauthenticated token exchange.
Always install a docker authorizer and only attach the credential callback when both username and password are set.
Fixes: #
How Has This Been Tested?
How are existing users impacted? What migration steps/scripts do we need?
Checklist:
I have: