fix: enforce per-token rate limiting for authenticated API users#154
Open
fix: enforce per-token rate limiting for authenticated API users#154
Conversation
… pagination Homepage no longer runs COUNT(*) for cases/laws — button now says "View all cases" instead of showing the exact total. Case list pagination uses LimitedPaginator and shows "> N items" when the count exceeds PAGINATE_BY * PAGINATE_UNTIL. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Also updates the DE theme homepage to remove explicit counts from both the cases and laws buttons. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add dedicated docs/sitemap-xml.md covering sitemap feature (URLs, caching, sections, how to extend). Add Sitemap directive to robots.txt so search engines can discover the sitemap index automatically. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The DEFAULT_THROTTLE_CLASSES only contained AnonRateThrottle, so the "user": "5000/hour" rate in DEFAULT_THROTTLE_RATES was dead config. Add a custom TokenUserRateThrottle that enforces the default rate for all authenticated users and supports per-token overrides via a new rate_limit field on APIToken. Co-Authored-By: Claude Opus 4.6 <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.
Summary
TokenUserRateThrottletoDEFAULT_THROTTLE_CLASSESso the existing"user": "5000/hour"rate is actually enforced for authenticated users (previously onlyAnonRateThrottlewas active)rate_limitfield toAPITokenmodel allowing per-token rate override (NULL = use default)Test plan
test_throttling.py): basic throttling, anonymous bypass, custom rate override (higher/lower), session auth, Retry-After header, per-user counters, rate_limit=0rate_limitfield default and custom valueruff formatandruff checkclean🤖 Generated with Claude Code