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

Fix Docker authentication #926

Merged
merged 3 commits into from
Jan 24, 2025
Merged

Fix Docker authentication #926

merged 3 commits into from
Jan 24, 2025

Conversation

ezekg
Copy link
Member

@ezekg ezekg commented Jan 23, 2025

Surprises never stop coming. This refactors the OCI engine to follow Docker's authentication dance per the distribution registry spec. Essentially, even if registry credentials are added via docker login oci.pkg.keygen.sh, Docker won't send the credentials unless the registry first sends a 401 Unauthorized status code (imo a waste of time and bandwidth but wtfe).

The downside to this is that we now leak information by responding with 401/403s instead of 404s, but since this is limited only to packages using an OCI engine, I think the risk is low and it can be considered expected behavior.

Follow up to #914.

@ezekg ezekg marked this pull request as ready for review January 24, 2025 05:42
@ezekg ezekg force-pushed the fix/docker-authn branch 2 times, most recently from f234e9f to 7fbc691 Compare January 24, 2025 16:02
challenge_realm = 'keygen'
challenge = %(#{challenge_scheme} realm="#{challenge_realm}")

response.headers['WWW-Authenticate'] = challenge
Copy link
Member Author

@ezekg ezekg Jan 24, 2025

Choose a reason for hiding this comment

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

Should probably refactor this challenge logic out into the authentication concern.

@ezekg ezekg merged commit 9017abd into master Jan 24, 2025
5 checks passed
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.

1 participant