How to prevent overload / overuse on api (web) endpoint?

Let's say I have a web server and is working with an API endpoint (for example .../post) that allows the user to create something (and save it to the database). Someone can use a loop to send a huge number of requests to this endpoint, and the database will contain garbage data.

What is considered best practice to protect an endpoint from overuse / overload by someone (a hacker) to prevent database overflows?

+4
source share
2 answers

I would recommend filtering users or IP. Basically, keep track of each request, and if someone exceeds a certain number, do not allow further requests.

You can implement it yourself, saving the track of the number of requests of each user or IP address, or you can use some already built code, for example, Rack attack .

+1
source

API, API , , , , . Google API, (, ).

0

Source: https://habr.com/ru/post/1534554/


All Articles