Add per-user rate limits for project and group transfers
What does this MR do and why?
Adds per-user limits to project and group transfers. The REST API, GraphQL and the web interface share the same two limits:
| Limit | Applies to | Key |
|---|---|---|
| 10 per minute per user | Transferring a project: PUT /projects/:id/transfer, POST /groups/:id/projects/:project_id, projectTransfer and the web interface |
project_transfer |
| 5 per minute per user | Transferring a group: POST /groups/:id/transfer, POST /groups/:id/transfer_to_organization, groupTransfer and the web interface |
group_transfer |
This brings these actions in line with the existing limits on similar actions.
- Both limits are staged rules behind the
namespace_transfer_rate_limitfeature flag, which is disabled by default. While the flag is off, requests over the limit are logged but not blocked. - The limits are checked after authorization, so a request from a user who can't transfer the project or group gets
403or404and doesn't count. The admin-onlyPOST /groups/:id/projects/:project_idchecks afterauthenticated_as_admin!. - Each rule has a contract entry in
config/rate_limits/unowned.yaml, and the docs list both in the non-configurable rate limits. - Not covered: the admin area transfer action, which only instance administrators can use.
Production traffic
Transfers per user per minute on 2026-11-30, from the endpoints above:
| Limit | Hours that returned | Requests | Busiest minute for one user | Users over the limit |
|---|---|---|---|---|
| Project transfers, 10 per minute | 8 of 24 | 675 | 14 | 1, in one minute |
| Group transfers, 5 per minute | 11 of 24 | 105 | 15 | 1, in one minute |
| GraphQL transfers | 20 of 24 | 0 | – | – |
The rest of the hours timed out in Kibana. Only one user in each sample went over, each in a single minute. A week of log mode before the flag is enabled shows the full picture, including automation that transfers in bulk.
References
- Rollout issue: #635772
Screenshots or screen recordings
Not applicable, there are no UI changes.
How to set up and validate locally
-
As a project owner, transfer projects (
PUT /api/v4/projects/:id/transfer) more than 10 times in a minute. -
With the flag disabled, the requests aren't blocked.
log/api_json.logshowsapplimiter_project_transfer:limit_project_transfers_by_user_loginrate_limit_state. -
Enable the feature flag in the Rails console:
Feature.enable(:namespace_transfer_rate_limit) -
Repeat the requests. Requests over the limit receive a
429response.
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.