Skip to content

Match authorization helpers based on registry#479

Merged
jklukas merged 1 commit intobazeltools:mainfrom
jklukas:main
Jan 16, 2025
Merged

Match authorization helpers based on registry#479
jklukas merged 1 commit intobazeltools:mainfrom
jklukas:main

Conversation

@jklukas
Copy link
Copy Markdown
Member

@jklukas jklukas commented Jan 16, 2025

Problem

I need to use rules_minidock with a registry where the service returned in the authentication challenge is not the registry base name, but rather a logical service name "Authentication". The header returned by the registry is like:

www-authenticate: Bearer realm="https://registry.example.com/auth/token/",service="Authentication"

I want to provide an authentication helper script to respond to this challenge, but it's never picked up by puller_app, etc. because the current logic always does matching based on the bearer service; so I believe there's an assumption here that service will be the registry base name (such as registry.example.com) but this is not necessarily true.

Solution

We maintain the current matching logic, but if no matching authentication helper is found based on service, we try to match based on the registry parameter sent to puller_app or pusher_app.

@jklukas
Copy link
Copy Markdown
Member Author

jklukas commented Jan 16, 2025

This should probably get review from @ianoc who originally set up the authentication helper support.

// an actual registry name, so if no match is found based on the Bearer "service" then
// we'll try to match based on the registry name.
// See https://distribution.github.io/distribution/spec/auth/token/
.or_else(|| docker_authorization_helpers.iter().find(|e| e.registry == registry));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@jklukas jklukas enabled auto-merge (squash) January 16, 2025 19:33
@jklukas jklukas merged commit 14d7b5d into bazeltools:main Jan 16, 2025
@jklukas
Copy link
Copy Markdown
Member Author

jklukas commented Jan 16, 2025

@ianoc - Are there release steps necessary here beyond just pushing a tag?

@jklukas
Copy link
Copy Markdown
Member Author

jklukas commented Jan 16, 2025

@ianoc - Are there release steps necessary here beyond just pushing a tag?

I see now that there's a github action configured to run when a new release is cut, so I went ahead and cut v0.0.69.

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

Successfully merging this pull request may close these issues.

2 participants