acmucsd / membership-portal

REST API for the UC San Diego ACM chapter's membership portal.
https://members.acmucsd.com
Mozilla Public License 2.0
17 stars 5 forks source link

Rate Limit API Calls #391

Closed nik-dange closed 8 months ago

nik-dange commented 9 months ago

Description

Closes #349

Changes

Type of Change

If you've selected Patch, Minor, or Major as your change type, make sure to bump the version before merging in package.json!

Testing

I have tested that my changes fully resolve the linked issue ...

Checklist

Screenshots

Please include a screenshot of your Postman testing passing successfully.

github-actions[bot] commented 9 months ago

Thanks for contributing! If you've made changes to the API's functionality, please make sure to bump the package version—see this guide to semantic versioning for details—and document those changes as appropriate.

nik-dange commented 9 months ago

Regarding the numbers:

What do we want for max requests in a certain time frame, specifically for Express Check-in & User Login? Do we also want to look at rate limiting other routes (while maybe not necessary, would be nice since the code exists)?

farisashai commented 9 months ago

does this rate limit all event related endpoints on the api? If so, can you check with alex and Sean if it breaks the portal ui in any way from something simple like refreshing the events page nonstop

nik-dange commented 9 months ago

Oops, ignore line 14 in RateLimiter.ts + any changes in EventController.ts for now; that was just me experimenting with various ways of applying different limits to different endpoints. In theory, we can customize the numbers for different endpoints, or not limit any endpoints at all (in the case of something like fetching events, if it messes with the UI)

nik-dange commented 8 months ago

Accidentally included a bunch of other changes in this PR–nuking it for a cleaner one