Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readOnly operations fail against registries that require basic auth #1525

Open
arsing opened this issue Jan 10, 2020 · 1 comment
Open

readOnly operations fail against registries that require basic auth #1525

arsing opened this issue Jan 10, 2020 · 1 comment
Assignees

Comments

@arsing
Copy link

arsing commented Jan 10, 2020

For private registries, one must be able to provide basic auth creds, via NOTARY_AUTH env var or interactively. However, the code assumes that all readOnly operations can be anonymous, which in turn suppresses sending the auth header.

We discovered this problem because #1315 made lookup a readOnly operation, so now notary lookup cannot be used with private registries even if NOTARY_AUTH is set.

Reverting ad8b0a7 fixes the problem for us, though I believe the real issue is that readOnly is synonymous with "anonymous".

@HuKeping HuKeping self-assigned this Jan 15, 2020
@yoheiueda
Copy link

Any update on this issue?

yoheiueda added a commit to yoheiueda/notary that referenced this issue Jun 29, 2021
Fixes notaryproject#1525.

authRoundTripper.RountTrip first tries to access a server anonymously.
This attempt fails if fetching a token requires basic authentication, but
t.RoundTrip returns a non-nil error even if fetching a token fails due to
http.StatusUnauthorized(401).

This change fixes the issue by checking whether the non-nil error is
actually caused by http.StatusUnauthorized(401) or not.

Signed-off-by: Yohei Ueda <yohei@jp.ibm.com>
yoheiueda added a commit to yoheiueda/notary that referenced this issue Jun 29, 2021
Fixes notaryproject#1525.

authRoundTripper.RountTrip first tries to access a server anonymously.
This attempt fails if fetching a token requires basic authentication, but
t.RoundTrip returns a non-nil error even if fetching a token fails due to
http.StatusUnauthorized(401).

This change fixes the issue by checking whether the non-nil error is
actually caused by http.StatusUnauthorized(401) or not.

Signed-off-by: Yohei Ueda <yohei@jp.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants