-
Notifications
You must be signed in to change notification settings - Fork 39
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
Unable to authenticate on public ECR #180
Comments
I just tried with the #176 fix. I think the header should be updated if >>> type(self.auth)
<class 'oras.auth.basic.BasicAuth'>
>>> self.auth.get_auth_header()
{'Authorization': 'Basic Tez4dgfV5SndZWGxz...'} |
Also note that 0.2.2 actually sends the credentials, but as a bearer token (not sure it is correctly understood by the ECR API): >>> headers, changed = self.auth.authenticate_request(response, headers)
>>> headers
{'Authorization': 'Bearer eyJwYXlsb2FkIjoiY0...'} |
My suggestion is to make an auth backend that explicitly matches what the registry needs. That was the reason for the redesign of auth generally - getting all these different flows to work with just one implementation is near impossible. |
I understand, and as I said, maybe it's just a lack in the auth doc that doesn't show any custom auth backend example: https://oras-project.github.io/oras-py/getting_started/user-guide.html#authentication That said, the public ECR only requires basic auth which is actually implemented, but it just seems ineffective, as the code clearly only updates requests headers for the Token auth class. It's not clear why the implemented basic auth would actually means "no auth", and how a custom auth backend would work while the code has hard coded condition to update headers only for token auth. |
Feel free to contribute to the project to fix documentation, code, or the defaults. Thanks! |
Sure, but would a PR that injects auth header for basic auth be ok ? |
Injects? |
Yes, adding the auth header into the headers dict. Sorry, that wasn't clear. I've finally been able to make it work with any version: the problem was that I was calling But the Replacing Now I'm not sure if it's a doc issue or if I'm doing something wrong... |
If you found a way that works, why would you be doing something wrong? If you think there could be better docs for this case, a PR would be greatly appreciated. |
Hi !
Following #176, I finally need to enable authentication on AWS public ECR to avoid rate limiting.
But I think there's either a bug or an issue in the authentication doc:
AWS provides me a token to be used as basic auth with the
AWS
username.I tried both token and basic auth but neither actually work.
I've debugged the situation here: https://github.com/oras-project/oras-py/blob/main/oras/provider.py#L992
With token auth,
self.auth.get_auth_header()
always returns{'Authorization': 'Bearer None'}
. Maybe it's related to the bug described in fix: do not set empty token so anon works for public ecr #176 and that you fixed but I havent tried the fix as it's not released.With the basic auth, well the credentials are just ignored as you only update headers for the token auth module: https://github.com/oras-project/oras-py/blob/main/oras/provider.py#L988
In both cases, I can't authenticate on public ECR.
Do I miss something ?
Thanks !
The text was updated successfully, but these errors were encountered: