Page MenuHomePhabricator

Limit the number of expensive API queries a user can perform
Open, In Progress, Needs TriagePublic

Description

We expose several APIs that allow users to perform expensive operations - parsing uncached pages, performing complex database queries, transforming media files, etc. These APIs pose a thread of denial-of-service scenarious, intentional or unintentional (compare T64615, T387478, T405335). To mitigate this risk, we should have a mechanism that achieves at least one of the two following improvements:

  • limit the number of concurrent requests per user, across all domains and APIs.
  • apply cost-based rate limiting per user, across all domains and APIs.

Note that this is different from per-IP rate limits imposed at the edge (requestctrl) and from per-service concurrency limits imposed in the service mesh (e.g. T398002, T350294). It is also distinct from from rate limits imposed by MediaWiki internally.

A solution to this need is being investigated as T399291: Epic: API Rate Limiting Architecture. The purpose of this ticket is to provide an explicit problem statement and act as a focus point for all efforts designed to address this issue.

Event Timeline

daniel renamed this task from Reduce the number of expensive API queries a user can perform to Limit the number of expensive API queries a user can perform.Sep 24 2025, 1:49 PM
daniel changed the task status from Open to In Progress.Oct 1 2025, 2:48 PM

Marking as "in progress" since we are working on T399291: Epic: API Rate Limiting Architecture.

Change #1296534 had a related patch set uploaded (by Daniel Kinzler; author: Daniel Kinzler):

[operations/deployment-charts@master] rest-gateway: cost limits for action=parse (shadow mode)

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

Change #1296534 merged by jenkins-bot:

[operations/deployment-charts@master] rest-gateway: cost limits for action=parse (shadow mode)

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