fix(routes): re-challenge on a rejected git proxy credential - #108
Merged
Conversation
A present-but-invalid token (e.g. one the system cache helper served past its 900s TTL) propagated as a bare 401 without WWW-Authenticate, so git failed the operation instead of erasing the stale credential and re-invoking its helper. Return the same Basic challenge the missing-credential path sends. Fixes #107 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
A present-but-invalid basic-auth token on
/git/*propagatedverify_agent_token's failure as a bare 401 with noWWW-Authenticateheader, so git treated the failure as terminal instead of erasing the stale credential and re-invoking its helper. This bites whenever the AMI's system-levelcredential.helper=cache --timeout=3600serves a web-identity token past its 900s TTL.The rejected-credential path now returns the same
Basic realm="devbox"challenge as the missing-credential path, with the verify error logged at debug. Adds a test asserting the challenge on a rejected credential (the existing test covers the no-credential 401).Server-side only — no agent release or AMI rebuild needed. Complements the infra-side removal of the cache helper (tracked separately).
Fixes #107
🤖 Generated with Claude Code
Note
Low Risk
Small, localized auth response change on the git proxy with a matching test; no change to successful auth or push authorization.
Overview
Fixes stale git credentials on
/git/*when devbox hosts send basic-auth with an expired or invalid web-identity token. Previouslyverify_agent_tokenfailures bubbled up as a plain 401 withoutWWW-Authenticate, so git treated the error as final and never cleared the cached password or re-ran the credential helper.Invalid tokens now follow the same path as missing credentials: 401 plus
WWW-Authenticate: Basic realm="devbox", with rejections logged at debug. A router test asserts that behavior for a present-but-stale basic-auth header.Reviewed by Cursor Bugbot for commit 895150b. Bugbot is set up for automated code reviews on this repo. Configure here.