Skip to content

restore anonymous registry pulls:#183

Merged
mergify[bot] merged 1 commit into
tinkerbell:mainfrom
jacobweinstock:fix
May 27, 2026
Merged

restore anonymous registry pulls:#183
mergify[bot] merged 1 commit into
tinkerbell:mainfrom
jacobweinstock:fix

Conversation

@jacobweinstock

@jacobweinstock jacobweinstock commented May 27, 2026

Copy link
Copy Markdown
Member

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:

  • updated the documentation and/or roadmap (if required)
  • added unit or e2e tests
  • provided instructions on how to upgrade

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>
@jacobweinstock jacobweinstock requested a review from Copilot May 27, 2026 21:57
@jacobweinstock jacobweinstock added the kind/bug Categorizes issue or PR as related to a bug. label May 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 docker authorizer so Bearer-token challenges can be answered for anonymous pulls.
  • Only attach the credential callback to the authorizer when both registryUsername and registryPassword are set.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread oci2disk/image/image.go
@jacobweinstock jacobweinstock added the ready-to-merge Signal to Mergify to merge the PR. label May 27, 2026
@mergify mergify Bot added the queued label May 27, 2026
@mergify

mergify Bot commented May 27, 2026

Copy link
Copy Markdown
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
  • all of:
  • any of [🛡 GitHub branch protection]:
    • check-success = Build (amd64, writefile)
    • check-neutral = Build (amd64, writefile)
    • check-skipped = Build (amd64, writefile)
  • any of [🛡 GitHub branch protection]:
    • check-success = Build (amd64, archive2disk)
    • check-neutral = Build (amd64, archive2disk)
    • check-skipped = Build (amd64, archive2disk)
  • any of [🛡 GitHub branch protection]:
    • check-success = Build (amd64, cexec)
    • check-neutral = Build (amd64, cexec)
    • check-skipped = Build (amd64, cexec)
  • any of [🛡 GitHub branch protection]:
    • check-success = Build (amd64, grub2disk)
    • check-neutral = Build (amd64, grub2disk)
    • check-skipped = Build (amd64, grub2disk)
  • any of [🛡 GitHub branch protection]:
    • check-success = Build (amd64, image2disk)
    • check-neutral = Build (amd64, image2disk)
    • check-skipped = Build (amd64, image2disk)
  • any of [🛡 GitHub branch protection]:
    • check-success = Build (amd64, kexec)
    • check-neutral = Build (amd64, kexec)
    • check-skipped = Build (amd64, kexec)
  • any of [🛡 GitHub branch protection]:
    • check-success = Build (amd64, oci2disk)
    • check-neutral = Build (amd64, oci2disk)
    • check-skipped = Build (amd64, oci2disk)
  • any of [🛡 GitHub branch protection]:
    • check-success = Build (amd64, qemuimg2disk)
    • check-neutral = Build (amd64, qemuimg2disk)
    • check-skipped = Build (amd64, qemuimg2disk)
  • any of [🛡 GitHub branch protection]:
    • check-success = Build (amd64, rootio)
    • check-neutral = Build (amd64, rootio)
    • check-skipped = Build (amd64, rootio)
  • any of [🛡 GitHub branch protection]:
    • check-success = Build (amd64, slurp)
    • check-neutral = Build (amd64, slurp)
    • check-skipped = Build (amd64, slurp)
  • any of [🛡 GitHub branch protection]:
    • check-success = Build (amd64, syslinux)
    • check-neutral = Build (amd64, syslinux)
    • check-skipped = Build (amd64, syslinux)
  • any of [🛡 GitHub branch protection]:
    • check-success = DCO
    • check-neutral = DCO
    • check-skipped = DCO

mergify Bot added a commit that referenced this pull request May 27, 2026
@mergify mergify Bot merged commit e25b9c7 into tinkerbell:main May 27, 2026
21 checks passed
@jacobweinstock jacobweinstock deleted the fix branch May 27, 2026 22:04
@mergify mergify Bot removed the queued label May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug. ready-to-merge Signal to Mergify to merge the PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants