-
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
Description
Issue Type
Feature Enhancement / Security
Description
The backend API currently lacks rate limiting mechanisms, which can lead to several issues:
- Vulnerability to brute force attacks on authentication endpoints
- Potential for denial-of-service (DoS) attacks
- Uncontrolled resource consumption
- No protection against automated scraping or abuse
Current State
- No rate limiting is implemented in backend/base.py or any blueprint
- All endpoints are unprotected
- Razorpay payment endpoints could be abused
- Login and registration endpoints are particularly vulnerable
Proposed Solution
Implement rate limiting using Flask-Limiter:
- Add flask-limiter to backend/requirements.txt
- Configure rate limits in backend/config.py
- Add IP-based tracking with Redis backend for production
- Return proper HTTP 429 responses
- Add custom headers (X-RateLimit-Limit, X-RateLimit-Remaining)
Acceptance Criteria
- Rate limiting middleware integrated
- Different rate limits for different endpoint categories
- Proper error responses with retry-after information
- Configuration support for development vs production
- Documentation for rate limit policies
- Unit tests for rate limiting behavior
Additional Context
Critical for production deployment as the app integrates with Razorpay payments and handles user authentication.
Reactions are currently unavailable