Fix registry authorization errors#28235
Conversation
fe266c4 to
5f106f7
Compare
5f106f7 to
dc20fa3
Compare
distribution/errors.go
Outdated
There was a problem hiding this comment.
This needs to handle ErrorCodeUnauthorized, although this code should result in a token fetch most of the time, whereas ErrorCodeDenied is terminal.
There was a problem hiding this comment.
This is getting called when the error is terminal and will be returned back to the api handler. Right now the message getting returned by unauthorized is "correctly" getting picked up and prompting login. I am not too concerned with handling that case but after this PR I want to enumerate what all the cases are and the messaging getting sent to users.
|
LGTM |
|
@dmcgowan tests are failing |
|
Looks like trust failures are related to distribution/distribution#2044 in distribution. Going to update the trust build code to ensure the output is not changing due to this change. |
dc20fa3 to
fc1aaa2
Compare
|
Added a commit which resolves the issues with the distribution vendor update. The change to |
|
Tested LGTM |
|
However it's very possible that the only reason why these things work correctly is that We should probably fix |
|
@aaronlehmann I saw that in |
|
@dmcgowan: It turns out this is an issue for |
|
LGTM |
Pull in client changes to handle oauth errors Signed-off-by: Derek McGowan <[email protected]> (github: dmcgowan)
Handle updates to reference package. Updates for refactoring of challenge manager. Signed-off-by: Derek McGowan <[email protected]> (github: dmcgowan)
Translate pull errors to provide a more consistent and user friendly error message. Signed-off-by: Derek McGowan <[email protected]> (github: dmcgowan)
fc1aaa2 to
19a93a6
Compare
|
let's wait for #27917 before merging |
|
Adding some utility functions so that we can move to using |
…n-errors Fix registry authorization errors
Updates client to better handle errors when using OAuth tokens. Prevents unauthenticated errors getting sent back to the cli when permission is denied and erroneously prompting the user for login. This also trims error arrays down to a single element and logs the trimmed errors, this prevents the api from setting the status code to 401 when it sees "unauthorized" in one of the extra errors.
Needed for #28100
Closes #26462