Skip to content

fix(coderd/externalauth): detect rate-limit 403 and narrow isFailedRefresh (#24334)#25504

Merged
f0ssel merged 1 commit into
release/2.32from
backport/24334-to-2.32
May 19, 2026
Merged

fix(coderd/externalauth): detect rate-limit 403 and narrow isFailedRefresh (#24334)#25504
f0ssel merged 1 commit into
release/2.32from
backport/24334-to-2.32

Conversation

@github-actions
Copy link
Copy Markdown

Backport of #24334

Original PR: #24334 — fix(coderd/externalauth): detect rate-limit 403 and narrow isFailedRefresh
Merge commit: 1926b7e
Requested by: @f0ssel

…edRefresh (#24334)

ValidateToken treated all 403 responses as "token invalid," including
GitHub rate limits. isFailedRefresh included 403 in the status code
fallthrough, destroying tokens on rate-limited refresh attempts.

Split the combined 401/403 check in ValidateToken into a switch on
status code. On 403, inspect X-RateLimit-Remaining and Retry-After
headers; if either indicates a rate limit, return optimistically valid.
Handle 429 the same way. Plain 403 without rate-limit headers preserves
the existing invalid-token behavior.

Add incorrect_client_credentials and invalid_client to isFailedRefresh
error code switch. Remove 403 from the status code fallthrough since no
known provider returns 403 from the token endpoint.

(cherry picked from commit 1926b7e)
@github-actions github-actions Bot requested a review from f0ssel May 19, 2026 20:38
@f0ssel f0ssel merged commit e4defea into release/2.32 May 19, 2026
@f0ssel f0ssel deleted the backport/24334-to-2.32 branch May 19, 2026 20:43
@github-actions github-actions Bot locked and limited conversation to collaborators May 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants