techjoomla / com_api

API framework for Joomla
http://docs.techjoomla.com/joomla-rest-api/com-api-introduction
GNU General Public License v3.0
123 stars 97 forks source link

com_api incorrectly returns 403 API Rate Limit Exceeded when rate limit has not yet been reached #127

Open HumanPrinter opened 3 years ago

HumanPrinter commented 3 years ago

I've installed the com_api component in my Joomla website and created a plugin to expose a public GET-endpoint.

I'm using the default settings which sets a rate limit of 60 requests per hour. During testing I discovered that I receive 403 (Request Limit Exceeded) errors even when I have not yet sent 60 requests in the past hour. After some investigation, I noticed that the error is returned when the log-table contains 60 entries (regardless of the timestamp in those entries).

I found the bug that is causing this and created a pull request to correct this bug (#126)

Used versions and environments: Joomla version: 3.9.28 com_api version: 2.5.1 PHP version: 7.4.21