Rate limit epic board moves per user

What does this MR do and why?

epicMoveList has no rate limit. This MR adds a per user limit of 200 moves per minute, configurable with the epic_move_list_limit application setting (beta). The key rolls out in log mode first: while the epic_move_list_rate_limit gitlab_com_derisk flag is off, moves over the limit are logged under limit_epic_board_moves_by_user_log but not blocked. Enabling the flag enforces the limit.

  • 5d74f299 adds the setting and the epic_move_list rule.
  • c50916f8 checks the limit in the mutation. Each GraphQL alias counts against the limit, so one aliased request cannot go over it.
  • 0ed7c92d defines the rule with staged_rule, so the flag switches it from log mode to enforcement.
  • fb967884 moves the setting and the rule to the EE overrides, because epicMoveList exists only in EE.

The limit follows the pattern of gitlab-org/gitlab!266323.

References

Related to gitlab-org/gitlab#638275

Feature flag rollout: gitlab-org/gitlab#639098

How to set up and validate locally

  1. Set a low limit: ApplicationSetting.current.update!(epic_move_list_limit: 1).
  2. Move an epic between two lists on an epic board twice in one minute. Both moves succeed, and the request log line carries applimiter_epic_move_list:limit_epic_board_moves_by_user_log:log in rate_limit_state.
  3. Enable the flag: Feature.enable(:epic_move_list_rate_limit).
  4. Move the epic twice again in one minute. The second move returns the rate limit error.
Edited by Jorge Tomás

Merge request reports

Loading
Loading