fix(sync): prime catalog auth before listing repos#4004
Draft
AkashKumar7902 wants to merge 1 commit into
Draft
Conversation
da69090 to
3926102
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.
What
Fixes #3869.
This updates periodic sync catalog discovery so zot-to-zot sync can see repositories that require configured Basic credentials when the upstream registry also exposes some anonymous repositories.
Why
regclient does not send stored Basic credentials on the first
_catalogrequest unless it has already received an auth challenge. With mixed anonymous/authenticated policies, zot can return200for unauthenticated catalog requests while filtering the catalog down to anonymous repositories, so periodic sync never discovers protected repos.How
zot-syncUser-Agent for sync-created regclient instances./v2/before_catalogonly when credentials are configured for the remote host, giving regclient a chance to handle the Basic auth challenge./v2/challenge workaround tozot-syncclients, while preserving anonymous-only behavior.Validation
GOEXPERIMENT=jsonv2 go test -tags "sync lint" ./pkg/extensions/sync -run TestRemoteRegistryCatalogAuth -count=1GOEXPERIMENT=jsonv2 go test -race -tags "sync lint" ./pkg/extensions/sync -run TestRemoteRegistryCatalogAuth -count=1GOEXPERIMENT=jsonv2 go test -tags "sync scrub metrics search lint userprefs mgmt imagetrust ui" ./pkg/api -run TestDockerClientV2ChallengeWorkaround -count=1git diff --checkGOEXPERIMENT=jsonv2 go test -tags "sync scrub metrics search lint" ./pkg/extensions/sync -run "TestRemoteRegistryCatalogAuth|TestBasicAuth" -count=1still hits the existing missing vulnerable alpine fixture beforeTestBasicAuthcan run:test/data/alpine/blobs/sha256/f56be85fc22e46face30e2c3de3f7fe7c15f8fd7c4e5add29d7f64b87abdaa09.