Skip to content

Add multi-tier IP rate limiting #103

Description

@Akatenvictor

What

Add IP-based rate limiting with configurable thresholds per endpoint category (auth, upload, API, admin).

Why

The current authRateLimiter applies a single rate limit to auth endpoints. Different endpoint categories need different thresholds to prevent abuse while allowing legitimate usage.

Scope

  • In: Multi-tier rate limiter, per-endpoint config, rate limit headers, sliding window
  • Out: Distributed rate limiting, rate limit bypass for trusted clients, adaptive limits

Acceptance Criteria

  • Rate limit tiers: auth (5/min), upload (10/hr), api (100/min), admin (30/min)
  • Rate limit headers in response: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
  • Sliding window algorithm instead of fixed window
  • 429 response with Retry-After header
  • Configurable via environment variables
  • In-memory store for single-instance, Redis-ready interface
  • Auth endpoints still have stricter global limit

Technical Context

  • Extend authRateLimiter in src/middlewares/ into a general rate limiter
  • New rateLimiter middleware in src/middlewares/
  • Config in src/config/ for rate limit settings
  • RequestLogger in src/middlewares/ for rate limit event logging
  • No Redis dependency yet, but interface should support it

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions