Add auth headers to request when using BasicAuth #215
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
I'm currently using
oras-py
as client library for a Zot OCI registry. In my current (rather simple) setup, I'm only usingBasicAuth
with username and password, noTokenAuth
.I noticed that when pushing a blob (by calling
registry.upload_blob()
), there is no authentication header, and thus Zot sometimes rejects the push.I say sometimes, because other times Zot seems fine without the auth header, and accepts the push. It's really hard to debug...
When adding the auth header to every request, Zot is happy.
I saw that there's a test for pushing using basic auth oras/tests/test_oras.py#L168 which I would expect to fail as well, so I really don't know...
Proposed Solution
Add the auth headers to the request, just like it's done with
TokenAuth
.NB: I have no clue if this is the right way, or if I'm misusing
oras-py
and should solve this a completely different waySteps to reproduce
my client script essentially looks like this:
relevant parts of Zot configuration: