-
-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API: Implement rate limiting in the API #12
Comments
@Sachinsharma01 assigned to you. Do open a thread in discord regarding this issue since we still haven't fixed on what parameters we will do the rate limit. So you can get on with this after we have came to a decision! |
ok, got it |
As per discussion, we are going to have rate limiting as below We would want to send OTP, validate OTP to be rate limited to 10 requests per minute for a single user |
Yes, correct. That looks good! @Sachinsharma01 |
yeah, picking this up for development |
can I work on this issue? @rajdip-b |
Sure thing! Go ahead. |
The requirements of this issue is still not clear, so please feel free to add a list of the implementations you would be making before you go ahead and code it. |
But the next 10days are very hectic for me and I can only start solving after that. If that's okay with you |
Yeah no problem with that |
Hi there, My team and I are paricipating in FOSS Hack 2025 are interested in working on this issue. Could you please provide guidance and more information regarding this issue. |
Howdy! yes, we will update the issue description with the details shortly. This issue has been present for a long time now. |
Howdy, Thanks for assigning the issue, I'll review the details once updated and get started. Let me know if there's anything specific you'd like us to consider. |
Hey, Rajdip hope everything's going well, so fosshack's tmrw, can you please guide us with the details regarding the api rate limiting issue. |
Oh boy, yes i absolutely forgot. I'm updating this right away. Thanks for dropping in a reminder |
Okay I think as of now this is a pretty generalized issue. We don't have any specific use cases as of now. What we would ideally like to have is, all the endpoints should have a rate limit for the number of requests. For instance, we don't want a user to be able to spam our APIs with automated requests. Let's say, someone tries to create a DOS attack on our servers by making expensive requests. The solution we would like to have is, put in a configurable number of requests per second that would be accepted by any users. We should be filtering this both based on IP Address and user ID. |
Hey Rajdip, Good Morning and a Happy Sunday :) So I was also thinking about future enhancements, like account lockout for too many failed OTP attempts, but I’m not exactly sure how I’d do it. Right now, I’m thinking of storing the lockout status in the database since I’m not familiar with it and don’t want to break anything. |
I don't think an unlock feedback would be needed. |
Also, we don't want the locks to be specific, but general to all the endpoints. But we should also have the ability to configure the max hits for each and every endpoint. I would suggest you to develop a custom decorator to override this. Something like As for storing the status, i think the cache might be a better place to do it. A tuple like (userId, endpoint, lockedUntil) would be a good choice. |
oh ok, well i have already implemented a general lock out period for all endpoints, we will work on the overide usinng a decorator. might i push a pr so you can review my progress? |
@Dhanushranga1, please open a draft PR linking this issue! |
@Dhanushranga1, please open a draft PR linking this issue; otherwise you will be unassigned from this issue after Tue Feb 25 2025 10:02:30 GMT+0000 (Coordinated Universal Time)! |
Is your feature request related to a problem? Please describe.
I would like the API to have rate limiting set up so that malicious actors can't spam our APIs.
Describe the solution you'd like
Use this document as a reference: https://docs.nestjs.com/security/rate-limiting
Suggestions for implementing this feature are most welcome!
The text was updated successfully, but these errors were encountered: