Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-09-09 15:09:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-09 15:09:09 +0300
commit7ce86c261b3f910cf17b0b47a4200847578947df (patch)
tree20665e6a2b836f9ab38ba86680fa39ba33a04f21 /lib/gitlab/rack_attack.rb
parent54573816ab79fac6716d1a1eae8c0da602765774 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/rack_attack.rb')
-rw-r--r--lib/gitlab/rack_attack.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/gitlab/rack_attack.rb b/lib/gitlab/rack_attack.rb
index e913a4d583c..7db7da03925 100644
--- a/lib/gitlab/rack_attack.rb
+++ b/lib/gitlab/rack_attack.rb
@@ -145,6 +145,18 @@ module Gitlab
end
end
+ throttle_or_track(rack_attack, 'throttle_unauthenticated_files_api', Gitlab::Throttle.unauthenticated_files_api_options) do |req|
+ if req.throttle_unauthenticated_files_api?
+ req.ip
+ end
+ end
+
+ throttle_or_track(rack_attack, 'throttle_authenticated_files_api', Gitlab::Throttle.authenticated_files_api_options) do |req|
+ if req.throttle_authenticated_files_api?
+ req.throttled_user_id([:api])
+ end
+ end
+
rack_attack.safelist('throttle_bypass_header') do |req|
Gitlab::Throttle.bypass_header.present? &&
req.get_header(Gitlab::Throttle.bypass_header) == '1'