fix(auth): stop refresh 429 bouncing users to login; restore badge text color#249
Merged
Merged
Conversation
…xt color The /auth/refresh endpoint shared login's strict 5/minute brute-force limit, but it carries no user credentials (only a signed HttpOnly refresh cookie) and the frontend calls it automatically on every page load (twice under React StrictMode in dev). A few reloads exhausted the limit, returning 429 and bouncing authenticated users to the login page. Add a separate REFRESH_RATE_LIMIT (60/minute) for the refresh endpoint so normal reloads survive while still bounding abuse of the rotating-token endpoint. Update tests accordingly. Also revert badge variant text from text-foreground (white) back to the per-variant colors so success/default badges render green again.
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.
Summary
Follow-up to #247, which fixed the refresh cookie path but did not fully fix session survival on reload.
Session refresh (the real cause)
POST /auth/refreshshared login's strict brute-force limit (AUTH_RATE_LIMIT = 5/minute). But refresh carries no user credentials — only a signed HttpOnly cookie — and the frontend calls it automatically on every page load (twice under React StrictMode in dev). A few reloads exhausted the limit, returning 429, whichrestoreSession()treats as "no session" → user bounced to the login screen.REFRESH_RATE_LIMIT = 60/minuteinrate_limit.py./auth/refreshnow uses it instead ofAUTH_RATE_LIMIT.Badge text color
Revert all six
badge.tsxvariants fromtext-foreground(white) back to their per-variant colors, sosuccess/defaultbadges render green again.Validation
pnpm run type-check,pnpm run lint,pnpm test(79 passed)uv run pytest --cov=app(396 passed),uv run mypy app/(clean),uv run ruff check(clean on changed files)Fixes #245