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

Issues if the container registry (serverURL) isn't just the hostname #3

Closed
simongottschlag opened this issue Jan 22, 2022 · 7 comments

Comments

@simongottschlag
Copy link

Hi!

Thank you for the great work of maintaining this package. 🥇

I've been troubleshooting an issue with cosign when it comes to authenticating to the Azure Container Registry. One of the issues I've found is that somewhere along the way, the whole container image URL is passed to your helper and it causes the authentication to fail.

Reference for the method:

func (a ACRCredHelper) Get(serverURL string) (string, string, error) {

If we look at the same Elastic Container Registry (AWS) helper, we can clearly see them extracting information before passing it to their other functions: https://github.com/awslabs/amazon-ecr-credential-helper/blob/69c85dc22db6511932bbf119e1a0cc5c90c69a7f/ecr-login/ecr.go#L46

I'll create a PR for you to review.

Reference for the cosign issue: sigstore/cosign#1350

@imjasonh
Copy link
Contributor

Hi! 👋

I added that code in #2 and I think I see the bug. I'll send a PR now.

@simongottschlag
Copy link
Author

@imjasonh hi! 😊

I was actually experiencing the issue before using your patch. Or at least I think so. 🤔

@simongottschlag
Copy link
Author

@imjasonh please take a look at the following before: #4

@imjasonh
Copy link
Contributor

@imjasonh hi! 😊

I was actually experiencing the issue before using your patch. Or at least I think so. 🤔

Yep, I thought I was looking for a bug in Get when it looks like it's actually just the refresh token flow when repos are included. Completely missed your PR, which is much better 😆

@simongottschlag
Copy link
Author

@imjasonh Do you think we should still add this even tough we fixed it in go-containerregistry?

@imjasonh
Copy link
Contributor

I'll leave that up to @chrismellard -- the normal way this code is called is with just the hostname and no path component, it was (seemingly) only due to a bug in that library's usage that it was being called in any other way.

In the spirit of Postel's Law it might make sense to be more flexible in what this accepts, but I don't think we need it anymore, since we're doing the right thing now.

@simongottschlag
Copy link
Author

Great! It's up to you @chrismellard 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants