Loading
Add rate limits to group and system hook creation APIs
What does this MR do and why?
POST /groups/:id/hooks and POST /hooks had no rate limit, so hooks could be created and deleted in a loop. This adds limits shaped like the project hooks one from !263931 (merged).
- Group hooks: 10 requests per minute per user per group, setting
group_hooks_create_limit. - System hooks: 5 requests per minute per user, setting
system_hooks_create_limit. - Both settings sit in the existing Webhook rate limits admin section and the settings API.
0turns a limit off. No feature flag, no migration (rate_limitsJSON column). - The group setting lives in CE next to
web_hook_test_limit, which already covers EE group hooks, instead of adding EE-only settings plumbing.
References
Screenshots or screen recordings
Two new number fields in Admin > Settings > Network > Webhook rate limits. No other UI change.
How to set up and validate locally
- As an admin with an
api+admin_modetoken, send sixPOST /api/v4/hooksrequests in a minute. The first five return201, the sixth429withRetry-After: 60. - As a group owner (Premium), send eleven
POST /api/v4/groups/:id/hooksrequests in a minute. The eleventh returns429. The same user on another group still gets201. PUT /api/v4/application/settingswithsystem_hooks_create_limit=0. After the settings cache expires (about a minute), creation is no longer limited.
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.