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. 0 turns a limit off. No feature flag, no migration (rate_limits JSON 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

  1. As an admin with an api + admin_mode token, send six POST /api/v4/hooks requests in a minute. The first five return 201, the sixth 429 with Retry-After: 60.
  2. As a group owner (Premium), send eleven POST /api/v4/groups/:id/hooks requests in a minute. The eleventh returns 429. The same user on another group still gets 201.
  3. PUT /api/v4/application/settings with system_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.

Merge request reports

Loading
Loading