From f8edcff7e9aff93f8ac605c19e542204b0ed9ba2 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 22 Dec 2022 03:09:39 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- lib/api/helpers.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/api/helpers.rb') diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 0b5a471ea12..95c81c14bf9 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -695,6 +695,16 @@ module API unprocessable_entity!('User must be authenticated to use search') end + def validate_search_rate_limit! + return unless Feature.enabled?(:rate_limit_issuable_searches) + + if current_user + check_rate_limit!(:search_rate_limit, scope: [current_user]) + else + check_rate_limit!(:search_rate_limit_unauthenticated, scope: [ip_address]) + end + end + private # rubocop:disable Gitlab/ModuleWithInstanceVariables -- cgit v1.2.3