Add rate limiter for registration route #593
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds an (optional) rate limiter to the registration route to help mitigate abuse. Without throttling, bots or malicious users could potentially create millions of accounts in a short period or perform a denial-of-service attack by overwhelming the endpoint.
Testing Considerations
I haven't included automated tests for this functionality yet. If someone can offer guidance or assistance on the best approach to test this rate limiter, that would be greatly appreciated.
Documentation
The UPGRADE.md file currently includes changes to the two-factor rate limiting. I was uncertain, if this addition should be included aswell.
Rate Limiting Logic
The current logic (5 registrations per minute per IP) is debatable. I welcome discussion on whether this limit should be adjusted, made configurable, or if alternative approaches should be considered.