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>2023-02-22 15:07:55 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-22 15:07:55 +0300
commitfb336d5f6b8b2c8f3131ee97a68ebc80c64a0223 (patch)
tree902d2767f2c9ca4dd5a971eccd68a69e75a6ef78 /lib/gitlab/rack_attack.rb
parent2b0b59094ad207c5e608537d398c822970930b19 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/rack_attack.rb')
-rw-r--r--lib/gitlab/rack_attack.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/gitlab/rack_attack.rb b/lib/gitlab/rack_attack.rb
index bedbe9c0bff..b647965bb22 100644
--- a/lib/gitlab/rack_attack.rb
+++ b/lib/gitlab/rack_attack.rb
@@ -19,7 +19,7 @@ module Gitlab
[429, { 'Content-Type' => 'text/plain' }.merge(throttled_headers), [Gitlab::Throttle.rate_limiting_response_text]]
end
- rack_attack.cache.store = Gitlab::RackAttack::InstrumentedCacheStore.new
+ rack_attack.cache.store = cache_store
# Configure the throttles
configure_throttles(rack_attack)
@@ -27,6 +27,14 @@ module Gitlab
configure_user_allowlist
end
+ def self.cache_store
+ if ENV['GITLAB_RACK_ATTACK_NEW_STORE'] == '1'
+ Gitlab::RackAttack::Store.new
+ else
+ Gitlab::RackAttack::InstrumentedCacheStore.new
+ end
+ end
+
# Rate Limit HTTP headers are not standardized anywhere. This is the latest
# draft submitted to IETF:
# https://github.com/ietf-wg-httpapi/ratelimit-headers/blob/main/draft-ietf-httpapi-ratelimit-headers.md