image/docker: retry push when the ping advertised no challenges - #1028
Open
satwiksps wants to merge 1 commit into
Open
image/docker: retry push when the ping advertised no challenges#1028satwiksps wants to merge 1 commit into
satwiksps wants to merge 1 commit into
Conversation
A registry may allow unauthenticated GET/HEAD but require authentication for writes. The GET /v2/ ping in detectProperties() then succeeds without advertising any authentication challenge, so the client records none, sends the blob upload POST unauthenticated, and gives up on the resulting 401 even though it does have usable credentials. Record the challenges from such a 401 response and retry the request with them. The retry keeps the scope it already had: only an insufficient_scope error asks for a different one. challenges are no longer written only once from detectProperties(), so protect them with a mutex; concurrent blob uploads share one client. Fixes: podman-container-tools#1009 Signed-off-by: Satwik Sai Prakash Sahoo <sahoospsatwik@gmail.com>
satwiksps
force-pushed
the
fix-auth-retry-missing-challenges
branch
from
August 4, 2026 00:57
95cf619 to
343380b
Compare
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.
Some registries allow unauthenticated
GET/HEADbut require auth for writes. theGET /v2/ping indetectProperties()then succeeds without advertising any authentication challenge, so the client records none, sends the blob uploadPOSTunauthenticated, and gives up on the resulting401, even though it has perfectly good credentials sitting there.needsRetryWithUpdatedScopenow records the challenges carried by such a401and asks for a retry. retry keeps the scope it already had: only aninsufficient_scopeerror asks for a different one, and dropping the caller'sextraScopewould break cross-repo blob mounts, which pass one. becausechallengesis no longer written just once fromdetectProperties(), it's now protected by a mutex, concurrent blob uploads share a single client.tests cover the new path, basic and bearer challenges,
insufficient_scopestill returning its scope, a401with no challenge at all, challenges on a non-401 being ignored, and already-recorded challenges not being overwritten.