Skip to content

fix(routes): re-challenge on a rejected git proxy credential - #108

Merged
jplock merged 1 commit into
mainfrom
fix/107-git-proxy-challenge
Jul 20, 2026
Merged

fix(routes): re-challenge on a rejected git proxy credential#108
jplock merged 1 commit into
mainfrom
fix/107-git-proxy-challenge

Conversation

@jplock

@jplock jplock commented Jul 20, 2026

Copy link
Copy Markdown
Member

A present-but-invalid basic-auth token on /git/* propagated verify_agent_token's failure as a bare 401 with no WWW-Authenticate header, 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-level credential.helper=cache --timeout=3600 serves 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. Previously verify_agent_token failures bubbled up as a plain 401 without WWW-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.

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>
@jplock
jplock merged commit a700c13 into main Jul 20, 2026
9 checks passed
@jplock
jplock deleted the fix/107-git-proxy-challenge branch July 20, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

git proxy 401 for an expired token omits the WWW-Authenticate challenge

1 participant