Return Basic auth challenges instead of 500 (Allows use of Git credential helpers) - #17
Open
thomasantony wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
return authentication error responses instead of throwing them
add a proper WWW-Authenticate: Basic challenge for missing credentials
allow Git LFS to invoke configured credential helpers and retry with Basic authentication
Root cause
The initial unauthenticated Git LFS batch request caused the Pages Function to throw a Response. Cloudflare surfaced that as HTTP 500, so Git LFS never received a 401 challenge and never asked its credential helper for the stored R2 credentials.
Impact
Clients can keep credentials in a Git credential helper instead of embedding secrets in .lfsconfig or the LFS URL.
Validation
git diff --check
node --check _worker.js
direct Worker test: unauthenticated request returns 401 with WWW-Authenticate; authenticated request returns 200
deployed custom-domain integration test
successful real git lfs push and git push through the fixed proxy
verified uploaded R2 objects by full SHA-256 OID