Skip to content

[SECURITY] Implement API Rate Limiting #27

Description

@vallabhatech

Description

The application currently lacks protection against brute-force attacks or Denial of Service (DoS). Any user or bot can hit the login or registration endpoints indefinitely.

Proposed Fix

Integrate express-rate-limit as a middleware.

  • Limit general API hits to 100 per 15 minutes.
  • Limit Auth routes (Login/Register) to 5 attempts per 15 minutes.

Test Cases

  • TC1 (Normal Usage): Send 10 requests to /api/v1/users/login. Verify all receive 200 or 401 status codes.
  • TC2 (Rate Limit Trigger): Send 100+ requests rapidly. Verify the server returns 429 Too Many Requests.
  • TC3 (Reset logic): Wait for the limit duration (15 mins) and verify access is restored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions