Skip to content

image/docker: retry push when the ping advertised no challenges - #1028

Open
satwiksps wants to merge 1 commit into
podman-container-tools:mainfrom
satwiksps:fix-auth-retry-missing-challenges
Open

image/docker: retry push when the ping advertised no challenges#1028
satwiksps wants to merge 1 commit into
podman-container-tools:mainfrom
satwiksps:fix-auth-retry-missing-challenges

Conversation

@satwiksps

@satwiksps satwiksps commented Jul 27, 2026

Copy link
Copy Markdown

Some registries allow unauthenticated GET/HEAD but require auth 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 has perfectly good credentials sitting there.

needsRetryWithUpdatedScope now records the challenges carried by such a 401 and asks for a retry. retry keeps the scope it already had: only an insufficient_scope error asks for a different one, and dropping the caller's extraScope would break cross-repo blob mounts, which pass one. because challenges is no longer written just once from detectProperties(), it's now protected by a mutex, concurrent blob uploads share a single client.

tests cover the new path, basic and bearer challenges, insufficient_scope still returning its scope, a 401 with no challenge at all, challenges on a non-401 being ignored, and already-recorded challenges not being overwritten.

@github-actions github-actions Bot added the image Related to "image" package label Jul 27, 2026
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
satwiksps force-pushed the fix-auth-retry-missing-challenges branch from 95cf619 to 343380b Compare August 4, 2026 00:57
@satwiksps satwiksps changed the title image/docker: retry push with missing challenges image/docker: retry push when the ping advertised no challenges Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

image Related to "image" package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

'podman push' fails if GET/HEAD succeeds without authentication, but POST returns 401

1 participant