Add an application rate limit to merge request creation
What does this MR do and why?
Merge request creation has no dedicated rate limit. This adds a
merge_requests_create limit of 150 merge requests per minute for each
user, configurable through the new merge_requests_create_limit
application setting (Admin > Settings > Network > Merge request creation
rate limits, or the settings API). Set it to 0 to disable the limit.
MergeRequests::CreateService prepends RateLimitedService, as
Issues::CreateService does, so the web UI, REST, GraphQL and push options
share the limit and return 429 Too Many Requests when it is exceeded.
MergeRequests::CreateFromIssueService and the merge request email handler
do not go through execute, so they check the limit explicitly, before they
create a branch or apply patches. Push options report the limit as a push
error, and the dependency security update service uses
execute_without_rate_limiting.
References
https://gitlab.com/gitlab-org/gitlab/-/work_items/606714
Screenshots or screen recordings
| Before | After |
|---|---|
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.