Skip to content

Conversation

@dmcgowan
Copy link
Member

@dmcgowan dmcgowan commented Oct 13, 2023

When a credential handler is provided but no basic auth credentials are provided, handle the error specifically rather than treating the credentials as not implemented. This allows a clearer error to be provided to users rather than a confusing not implemented error or generic unauthorized error.

Currently there is no way for the caller to know why the authorization did not work since only the registry's unhandled authorization error is returned. This handles cases where either a user has provided a credential handler but has no saved logins or has token secrets but the registry requested basic auth.

Add unit tests for the basic auth case.

@dmcgowan dmcgowan added cherry-pick/1.6.x cherry-pick/1.7.x Change to be cherry picked to release/1.7 branch labels Oct 13, 2023
Copy link
Member

@samuelkarp samuelkarp left a comment

Choose a reason for hiding this comment

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

LGTM

samuelkarp

This comment was marked as duplicate.

@dmcgowan dmcgowan force-pushed the fix-basic-auth-credential-error branch 2 times, most recently from 0952bf4 to f796037 Compare October 13, 2023 18:58
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

one nit/suggestion, but definitely not a blocker

When a credential handler is provided but no basic auth credentials
are provided, handle the error specifically rather than treating
the credentials as not implemented. This allows a clearer error to
be provided to users rather than a confusing not implemented error
or generic unauthorized error.

Add unit tests for the basic auth case.

Signed-off-by: Derek McGowan <derek@mcg.dev>
@dmcgowan dmcgowan force-pushed the fix-basic-auth-credential-error branch from f796037 to 51c9ffe Compare October 13, 2023 19:50
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@mikebrow mikebrow left a comment

Choose a reason for hiding this comment

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

LGTM .. just a nit on the new error msg to possibly include what portion of the cred was missing user or secret

@mikebrow mikebrow merged commit 2357396 into containerd:main Oct 13, 2023
@dmcgowan dmcgowan added cherry-picked/1.6.x PR commits are cherry-picked into release/1.6 branch cherry-picked/1.7.x PR commits are cherry-picked into release/1.7 branch and removed cherry-pick/1.6.x cherry-pick/1.7.x Change to be cherry picked to release/1.7 branch labels Oct 14, 2023
@dmcgowan dmcgowan deleted the fix-basic-auth-credential-error branch April 20, 2024 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-picked/1.6.x PR commits are cherry-picked into release/1.6 branch cherry-picked/1.7.x PR commits are cherry-picked into release/1.7 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants