Skip to content
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

feat(router): request rate limit configuration #760

Merged
merged 3 commits into from
Oct 23, 2023
Merged

Conversation

kon14
Copy link
Contributor

@kon14 kon14 commented Oct 23, 2023

This PR introduces (limited) configuration options for client API request rate limiting.
Namely, it allows for configuring the maximum amount of requests per interval and interval duration.

-maxRequests: Maximum number of allowed user requests per reset interval.
-resetInterval: Request count reset timeframe. Expressed in seconds.
-exceedQuotaPenaltyDuration: Penalty duration for which to automatically block any subsequent requests once rate limit is exceeded. Expressed in seconds.

I was originally going to also expose an option for configuring the timeout period in exceedQuotaPenaltyDuration, but given how that could allow admins that are unfamiliar with said mechanic's internals to effectively perma-ban their own, as well as others', IPs by accident, I settled on a hardcoded 10s setting for this.

We should revisit the latter once the UI rework is finished, enabling this option and exposing endpoints for listing and managing active blocks.

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other (please describe)

Does this PR introduce a breaking change?

  • Yes
  • No

The PR fulfills these requirements:

  • It's submitted to the main branch
  • When resolving a specific issue, it's referenced in the PR's description (e.g. fix #xxx, where "xxx" is the issue number)

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature

Other information:

@ghost
Copy link

ghost commented Oct 23, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@kkopanidis kkopanidis merged commit 5629cb3 into main Oct 23, 2023
4 checks passed
@kkopanidis kkopanidis deleted the rate-limit-cfg branch October 23, 2023 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants