Rate limit unauthenticated contributor graph requests per project
What does this MR do and why?
Adds a per-project rate limit for unauthenticated contributor graph requests: 30 a minute per project, shared by the repository analytics page (charts) and the contributor graph JSON (show.json).
Anonymous callers can request the contributor graph of any public project on any ref. Each new ref is a fresh walk of up to 6,000 commits on the Gitaly shard that stores the repository. The commit-keyed cache from !266258 (merged) only helps repeat views, so a crawler that walks refs never hits it. On 6 to 8 Nov one public project got about 116,000 graph requests from 3,119 IPs, at most 19 per IP, so the per-IP throttle never saw it. Every one of its show.json requests was anonymous.
- What counts: anonymous
chartsrequests and anonymousshow.jsoncache misses. A JSON request served from the cache is free. - What's exempt: signed-in users and the HTML
showpage. - When limited: the request gets a 429 before any commit walk.
- Rollout: the limit is a
staged_rule, the same pattern as !268728 (merged). Until the default-offcontributor_graphs_unauthenticated_rate_limitflag is enabled for a project, it only logs: the request log line records theapplimiter_contributor_graphs_unauthenticatedresult, so the would-be blocks can be checked in Kibana before anything is enforced.
Why 30 a minute
Anonymous charts plus show.json requests per project per minute on GitLab.com, top 40 projects by volume:
| Day | Busiest project-minute | Project-minutes over 30 | Requests over 30 |
|---|---|---|---|
| 2026-10-29 (normal) | about 10 | 0 | 0 |
| 2026-11-07 (burst) | 450 | 441 (4 projects) | 18,815 |
On the normal day no project went above 20 anonymous requests in a minute. The log-mode data will confirm the value on busy public projects before enforcement.
No changelog entry, because the flag is off by default. Documentation will come with the MR that removes the flag, which is when the limit reaches self-managed.
References
- https://gitlab.com/gitlab-org/gitlab/-/work_items/636143
- Rollout issue: https://gitlab.com/gitlab-org/gitlab/-/work_items/639049
Screenshots or screen recordings
Not applicable: backend only.
How to set up and validate locally
- Pick a public project with a repository, for example
http://gdk.test:3000/<namespace>/<project>. - As an anonymous user, request the analytics page 31 times within a minute:
With the flag off, every request returns 200.
for i in $(seq 31); do curl -s -o /dev/null -w '%{http_code}\n' http://gdk.test:3000/<namespace>/<project>/-/graphs/main/charts; done - In the Rails console, enable the flag:
Feature.enable(:contributor_graphs_unauthenticated_rate_limit). - Wait for the next minute, then run the loop again: the 31st request returns 429.
- Sign in and open the same page in a browser: it loads.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.