Page MenuHomePhabricator

Adminstrator sets API rate limit for clients without an API key
Closed, ResolvedPublic

Description

"As an Administrator, I want to limit the number of API calls that can be made without an OAuth 2.0 API key during a particular period of time, so I can plan for and manage API traffic usage."

This ticket was originally to have a global pool for all API calls without an OAuth 2.0 client ID. However, based on a discussion on the wiki page, we decided to have a pool for each IPv4 or IPv6 calling address.

This doesn't keep the total pool of calls bounded at a reasonable size, which is a bummer for capacity estimation, but it's somewhat more useful for client developers to estimate their effort.

So, this task is to have a rate limit per IP address only for requests that are made without an OAuth 2.0 ID. This can be very simple; no need to do things like identify VPNs or IP blocks or TOR nodes or whatever. Just a pool per IP address.

For MVP, a good value is 500 requests/hour per IP address.

Event Timeline

I've made this a public-launch task. Supporting developers without a client ID is important for public use, but it's not a new paradigm and not one we need to work on for a beta release.

eprodromou triaged this task as Medium priority.
eprodromou renamed this task from Adminstrator sets API limit for clients without an API key to Adminstrator sets API rate limit for clients without an API key.Jul 29 2020, 1:38 PM
eprodromou updated the task description. (Show Details)

Change 619804 had a related patch set uploaded (by Ppchelko; owner: Ppchelko):
[operations/deployment-charts@master] Configure ratelimiter to support authenticated/anon limits for api

https://gerrit.wikimedia.org/r/619804

Change 619804 merged by jenkins-bot:
[operations/deployment-charts@master] Configure ratelimiter to support authenticated/anon limits for api

https://gerrit.wikimedia.org/r/619804

Change 620766 had a related patch set uploaded (by Ppchelko; owner: Ppchelko):
[operations/deployment-charts@master] Switch ratelimit service to V3 protocol

https://gerrit.wikimedia.org/r/620766

Change 620766 merged by jenkins-bot:
[operations/deployment-charts@master] Switch ratelimit service to V3 protocol

https://gerrit.wikimedia.org/r/620766

Pchelolo added a subscriber: Clarakosi.

The above patches were deployed, however we can't mark this as done:

  • anon rate limits are not working yet. They depend on a feature @Clarakosi introduced into envoy, but that will only be available in 1.16 that we are patiently waiting for. Once we update, one line needs to be uncommented and it should start working.
  • authenticated rate limits depend on OAuthRateLimiter.

Moving to blocked.

Change 626146 had a related patch set uploaded (by Hnowlan; owner: Hnowlan):
[operations/deployment-charts@master] api-gateway: use x-client-ip instead of x-forwarded-for IP

https://gerrit.wikimedia.org/r/626146

Change 626146 merged by jenkins-bot:
[operations/deployment-charts@master] api-gateway: use x-client-ip instead of x-forwarded-for IP

https://gerrit.wikimedia.org/r/626146