unkeyed / unkey

Open source API management platform
https://go.unkey.com
Other
2.76k stars 278 forks source link

MultiRatelimits should do a 2PC #1995

Open chronark opened 1 month ago

chronark commented 1 month ago

Preliminary Checks

Reproduction / Replay Link (Optional)

No response

Issue Summary

When using multiple ratelimits, we check all limits serially and reject if one of them is exceeded. However this means previously checked limits are incremented regardless of subsequent checks and could be incremented falsely if we end up rejecting the request later.

Steps to Reproduce

  1. Use an identity with mulitple limits
  2. set one limit high and one low
  3. trigger the lower limit
  4. observe how the upper limit's counter still increments

Expected behavior

Counters should only be incremented if none of the limits are exceeded

Other information

No response

Screenshots

No response

Version info

- OS:
- Node:
- npm:
linear[bot] commented 1 month ago

ENG-1293 MultiRatelimits should do a 2PC