Add rate limit for Explore project and group listing pages

What does this MR do and why?

Applies a per-user-or-IP limit of 200 requests per minute to the Explore groups page and the Explore topics pages. The Explore projects page only renders a shell and loads its list through GraphQL, so it isn't covered. The value follows the limits on the equivalent REST listing endpoints, so the same list is limited consistently however it is reached.

The limit is fixed, like the existing delete limits, and is enforced behind the explore_listing_rate_limit feature flag, which is disabled by default. Only the two Explore controllers owned by Groups and Projects use the check. The other Explore controllers are unchanged.

References

  • Rollout issue: #637710
  • Closes #637709

Screenshots or screen recordings

Not applicable, there are no UI changes.

How to set up and validate locally

  1. In the Rails console, enable the feature flag:

    Feature.enable(:explore_listing_rate_limit)
  2. Load /explore/groups more than 200 times in a minute.

  3. Confirm that requests over the limit receive a 429 response.

  4. Disable the feature flag and confirm the requests are no longer limited:

    Feature.disable(:explore_listing_rate_limit)

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

Edited by Shubham Kumar

Merge request reports

Loading
Loading