docker_client: Handle "invalid_scope" errors - #1640
Merged
Merged
Conversation
dcermak
force-pushed
the
handle-invalid-scope
branch
from
August 25, 2022 09:20
4005291 to
ac2ca5d
Compare
mtrmac
reviewed
Aug 25, 2022
mtrmac
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for reviving this!
Let’s get this finally done.
The overall approach LGTM.
dcermak
force-pushed
the
handle-invalid-scope
branch
3 times, most recently
from
August 26, 2022 09:36
1e05f27 to
12b2398
Compare
Contributor
Author
|
@mtrmac Thank you for the review! I have tried addressing your comments and added a few unit tests. |
mtrmac
reviewed
Aug 26, 2022
mtrmac
left a comment
Collaborator
There was a problem hiding this comment.
Thanks! That’s a great amount of tests.
- #1640 (comment), please move the logic to
makeRequestToResolvedURL. - the comment update #1640 (comment)
dcermak
force-pushed
the
handle-invalid-scope
branch
from
August 29, 2022 08:02
12b2398 to
2fd3305
Compare
dcermak
commented
Aug 29, 2022
mtrmac
reviewed
Aug 29, 2022
mtrmac
left a comment
Collaborator
There was a problem hiding this comment.
Thanks:
Last round from me, I promise: #1640 (comment) — the panic is a bit of a risk.
#1640 (comment) would be nice but is not blocking for me.
By default docker_client just uses the auth challenges from the /v2/ ping request to request a Bearer Token. For some requests (e.g. for /v2/_catalog on some registries) this might not be sufficient and return a a HTTP Unauthorized Error with the "www-authenticate" header including an "insufficient_scope" error. In that case the client will now retry the request and fetch a new token with updated challenges to have the "scope" matching for what the endpoint needs. This fixes containers#1478 Signed-off-by: Ralf Haferkamp <rhafer@suse.com> Signed-off-by: Ralf Haferkamp <ralf@h4kamp.de> Signed-off-by: Dan Čermák <dcermak@suse.com> Signed-off-by: Miloslav Trmač <mitr@redhat.com> Co-authored-by: Miloslav Trmač <mitr@redhat.com> Co-authored-by: Ralf Haferkamp <ralf@h4kamp.de>
dcermak
force-pushed
the
handle-invalid-scope
branch
from
August 30, 2022 07:02
2fd3305 to
3ce7f05
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.
This is a rebase of #1079 and fixes #1478