Skip to content

sec: Rate limiting on Auth endpoints #666

Description

@sahare77

Description
The POST /api/v1/token/ and POST /api/v1/auth/register/ endpoints currently do not have rate limiting, making them vulnerable to brute force and credential stuffing attacks.

Steps to Reproduce

  1. Send 100 rapid requests to /api/v1/token/ with wrong passwords.
  2. Observe all requests are processed without being blocked.

Expected Behavior
Implement Django REST Framework's AnonRateThrottle on the authentication views.

Implementation Hints

# backend/users/views.py
from rest_framework.throttling import AnonRateThrottle

class CustomTokenObtainPairView(TokenObtainPairView):
    throttle_classes = [AnonRateThrottle]

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