fix(api): throttle OAuth token requests by IP - #443
Conversation
Reuse the existing public-endpoint rate limiter before parsing token requests. Cover failed basic/post client authentication, per-IP budgets, and Retry-After. Closes #433 Co-Authored-By: Duyet Le <me@duyet.net> Co-Authored-By: duyetbot <bot@duyet.net>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Reviewer's GuideOAuth token requests now share the existing per-IP project-creation rate limiter, enforcing the configured five-per-minute budget before parsing or credential verification while preserving the established 429 response and headers. Tests cover both client authentication methods, deterministic exhausted-window behavior, retry metadata, and isolation between IPs. Sequence diagram for OAuth token rate limitingsequenceDiagram
participant Client
participant TokenEndpoint
participant Limiter
participant OAuth
Client->>TokenEndpoint: POST /token
TokenEndpoint->>Limiter: projectCreationRateLimit
alt IP budget exhausted
Limiter-->>Client: 429 RATE_LIMITED with Retry-After and rate-limit headers
else IP budget available
Limiter-->>TokenEndpoint: Allow request
TokenEndpoint->>OAuth: parseTokenBody
OAuth-->>Client: Token response or authentication error
end
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Summary
Closes #433.
Validation
Do not merge: awaiting review per user instruction.
Co-Authored-By: Duyet Le me@duyet.net
Co-Authored-By: duyetbot bot@duyet.net
🤖 Generated with Claude Code
Summary by Sourcery
Protect the OAuth token endpoint from excessive requests while preserving the existing rate-limit behavior and response contract.
Bug Fixes:
Tests: