ProjectTech4DevAI / ProjectTech4DevAI/kaapi-backend
Security: Introduce rate limit per endpoint
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 18
- Fork
- 10
- Merge trung bình
- 2 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 14
Mô tả
Describe the current behavior
Currently, Kaapi API endpoints have no rate limiting implemented. Any user or organization can make unlimited requests to any endpoint without restrictions. This creates several issues:
- A single user or organization can overwhelm the API with requests, consuming server resources and degrading performance for other users
- There's no protection against accidental or malicious misuse, such as runaway scripts or bot activity
- Celery operations like document uploads with provider integration or collection creation can cause celery job queue bloating
Describe the enhancement you'd like
Implement api level rate limiting across relevant API routes to ensure fair resource allocation and prevent misuse. The rate limiting should be conditional based on if it is a celery job endpoint or not. celery job endpoints such as collection creation, llm calls, etc should have lower number of api calls allowed per minute as compared to non celery job endpoints such as credential, onboarding, etc which can have higher number of api calls allowed per minute.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách xác định các định nghĩa route API và các endpoint được Celery hỗ trợ, sau đó lập danh sách các thao tác cần nhận từng giới hạn tốc độ. Làm rõ các ngưỡng mỗi phút và cơ chế giới hạn tốc độ trước khi triển khai. Được xem là hoàn thành khi các request được giới hạn khác nhau đối với các endpoint Celery và không dùng Celery, ngăn việc quá tải hàng đợi hoặc tài nguyên.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- api, backend-api-design, performance, security
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 35/100