fork distribution client v3 auth-challenge as an internal package (squashed)#2248
Merged
Subserial merged 7 commits intogoogle:mainfrom Mar 31, 2026
Merged
Conversation
7af546f to
143dafe
Compare
Contributor
Author
|
OK; Didn't like Co-authored-by, so just a squash then 🤷 |
d2e564d to
b2784e2
Compare
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #2248 +/- ##
===========================================
- Coverage 71.67% 52.99% -18.68%
===========================================
Files 123 165 +42
Lines 9935 11197 +1262
===========================================
- Hits 7121 5934 -1187
- Misses 2115 4553 +2438
- Partials 699 710 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This forks the distribution's registry client auth-challenge code v3.0.0; distribution/distribution@9ed95e7 The client code has moved to an internal package in the distribution project, and is used to handle `WWW-Authenticate` headers. It was written a long time ago, and only handles RFC 2617 (superseded by RFC 9110). Possibly there's more current implementations for this, but this would introduce new dependencies, so we can keep the status quo for now, and fork this code as an internal package. Keeping it internal, due to the known limitations mentioned above, and to avoid it being used by others assuming it's a general-purpose implementation. This is the result of the following steps: # install filter-repo (https://github.com/newren/git-filter-repo/blob/main/INSTALL.md) brew install git-filter-repo # create a temporary clone of docker cd ~/Projects git clone https://github.com/distribution/distribution.git distribution_auth cd distribution_auth # switch to v3.0.0 (git-filter doesn't like multiple branches, so reset) git reset --hard v3.0.0 # commit taken from git rev-parse --verify HEAD 9ed95e7365224025ee89365e12cf128e1f1bf965 git filter-repo --analyze # remove all code, except for 'internal/client/auth/challenge' # rename to 'pkg/v1/remote/internal/authchallenge' # include history of old location ('registry/client/auth/challenge') git filter-repo \ --force \ --path 'internal/client/auth/challenge' \ --path 'registry/client/auth/challenge' \ --path-rename internal/client/auth/challenge:pkg/v1/remote/internal/authchallenge # go to the target github.com/docker/docker repository cd ~/go/src/github.com/google/go-containerregistry # create a branch to work with git checkout -b fork_registryclient_authchallenge # add the temporary repository as an upstream and make sure it's up-to-date git remote add distribution_auth ~/Projects/distribution_auth git fetch distribution_auth # merge the upstream code git merge --allow-unrelated-histories --signoff -S distribution_auth/main History was squashed: - Refactor authorization challenges to its own package Split challenges into its own package. Avoids possible import cycle with challenges from client. - Fix minor "Challanges" typo - Fix gometalint errors - Fix typo in NewSimpleManager() documentation - Initial repo commit - init - format code with gofumpt Move registry client internal Our registry client is not currently in a good place to be used as the reference OCI Distribution client implementation. But the registry proxy currently depends on it. Make the registry client internal to the distribution application to remove it from the API surface area (and any implied compatibility promises) of distribution/v3@v3.0.0 without breaking the proxy. cleanup: move init funcs to the top of the source We make sure they're not hiding at the bottom or in the middle which makes debugging an utter nightmare! Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The Manager code is only used as part of tests; move it to _test files to have a clearer separation between "production" code and test-code. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
As this code is now only used as a test-utility; - Make the zero-value of simpleManager usable - Remove the constructor and interface definition - Un-export fields and mutex. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- change normalizeURL to not mutate the input URL. - move lowercasing into canonicalAddr. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
b2784e2 to
4caec6c
Compare
Subserial
approved these changes
Mar 31, 2026
Contributor
|
Looks good, especially the Apache license preface. |
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.
fork distribution client v3 auth-challenge as an internal package
This forks the distribution's registry client auth-challenge code v3.0.0;
distribution/distribution@9ed95e7
The client code has moved to an internal package in the distribution project,
and is used to handle
WWW-Authenticateheaders. It was written a long timeago, and only handles RFC 2617 (superseded by RFC 9110). Possibly there's more
current implementations for this, but this would introduce new dependencies, so
we can keep the status quo for now, and fork this code as an internal package.
Keeping it internal, due to the known limitations mentioned above, and to avoid
it being used by others assuming it's a general-purpose implementation.
This is the result of the following steps:
After adding the internal fork;
The Manager code is only used as part of tests; move it to _test files
to have a clearer separation between "production" code and test-code.