Repository navigation
fix(git-cred): diagnose a missing authtype capability - #8533
Open
SilverLenZ wants to merge 1 commit into
Open
SilverLenZ wants to merge 1 commit into
SilverLenZ wants to merge 1 commit into
Conversation
A git client older than 2.46 never sends `capability[]=authtype`, so the helper exits 0 with no output and git falls through to a username prompt, which fails under `GIT_TERMINAL_PROMPT=0` as "could not read Username". The failure is silent and looks exactly like a missing or broken helper: the README documents git >= 2.46 as a requirement, but nothing at runtime says the client is too old. Keep the contract: stdout stays empty and the exit code stays 0, so git still falls through and the `authtype` security gate is untouched. When the server did issue a `Nostr` challenge -- the case where this helper is the one that should have answered -- print one stderr line naming the requirement. A non-Nostr remote still exits silently, because that is not a buzz remote and has nothing to diagnose. Test: `old_git_no_authtype_capability` becomes table-driven over three challenges (none, Nostr, Basic) and asserts empty stdout/exit 0 in all three, the hint only for Nostr, and silence for Basic. Verified falsifiable: reverting the diagnostic fails the test at integration.rs:237. Co-authored-by: Ma'at <maat@vmi3238719.contaboserver.net> Signed-off-by: Lumen <82261e322dbb1c513d43f7dfbd700ff266732ff6180de73307fd169600fa3f01@vmi3238719.mellori-dojo.ts.net>
🔐 Codex Security Review
|
This branch has not been deployed
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.
Problem
A git client older than 2.46 never sends
capability[]=authtype. The helper then exited 0 with no output, git fell through to a username prompt, and underGIT_TERMINAL_PROMPT=0the whole thing failed as:The failure is silent and indistinguishable from a missing or broken credential helper. The README documents git >= 2.46 as a requirement, but nothing at runtime ever says the client is too old.
Fix
Keep the contract exactly as it was -- stdout stays empty and the exit code stays 0, so git still falls through and the
authtypesecurity gate is untouched. The only change is that when the server did issue aNostrchallenge (the case where this helper is the one that should have answered), print one stderr line naming the requirement.A non-Nostr remote still exits silently, because that is not a buzz remote and has nothing to diagnose.
Why the
wwwauthcheck is the right triggerwwwauth[]=Nostr method="GET"is the authoritative signal that the server issued a Nostr challenge. It is also the one field git does forward to the helper, which is what makes the diagnosis possible at all.For context on the underlying capability gate:
crates/git-credential-nostrgates oncapability[]=authtypeand exits 0 silently when it is absent. ThewwwauthNostr challenge is sufficient to establish that the server spoke Nostr, so the capability check is the redundant part -- and it is the part that is harmful, because it is the part git does not forward on older clients. This PR does not change that gate; it makes the symptom legible.Test
old_git_no_authtype_capabilityis now table-driven over three challenges and asserts the full contract in each case:wwwauth[]=Nostrwwwauth[]=BasicVerified falsifiable: reverting the diagnostic fails the test at
integration.rs:237.Suite: 8 passed, 0 failed.
The helper itself is sound on a current git
This change is about diagnosability, not a repair. On git 2.55 the helper produces a working NIP-98 credential end to end, with the
capability[]=authtypeline present in git's request:Captured from git's own credential request on the same client, the only difference between the two clients is the
capability[]line:So the
capability[]gate is not wrong in intent -- it is simply never reached on clients older than 2.46, where git does not announce the capability at all. This PR keeps the gate and makes the symptom name itself instead of looking like a missing helper.🤖 Generated with Claude Code