Skip to content

Return Basic auth challenges instead of 500 (Allows use of Git credential helpers) - #17

Open
thomasantony wants to merge 1 commit into
twilligon:masterfrom
thomasantony:codex/basic-auth-challenge
Open

Return Basic auth challenges instead of 500 (Allows use of Git credential helpers)#17
thomasantony wants to merge 1 commit into
twilligon:masterfrom
thomasantony:codex/basic-auth-challenge

Conversation

@thomasantony

Copy link
Copy Markdown

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

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