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>2019-12-05 03:07:50 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-05 03:07:50 +0300
commit54cbcea92909e69248abc9e6b92c7d14db3308a5 (patch)
tree1276f1c57b5ab1064db7197c2d28a8837d68d02d /config/initializers
parent71221554dd9ddf30f73035c89f78164e001aa96d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/1_settings.rb1
-rw-r--r--config/initializers/rack_attack_new.rb15
2 files changed, 14 insertions, 2 deletions
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index f3635613339..9c5a07919b3 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -645,6 +645,7 @@ Settings.rack_attack.git_basic_auth['ip_whitelist'] ||= %w{127.0.0.1}
Settings.rack_attack.git_basic_auth['maxretry'] ||= 10
Settings.rack_attack.git_basic_auth['findtime'] ||= 1.minute
Settings.rack_attack.git_basic_auth['bantime'] ||= 1.hour
+Settings.rack_attack['admin_area_protected_paths_enabled'] ||= false
#
# Gitaly
diff --git a/config/initializers/rack_attack_new.rb b/config/initializers/rack_attack_new.rb
index 92a8bf79432..6d29bb1cd8b 100644
--- a/config/initializers/rack_attack_new.rb
+++ b/config/initializers/rack_attack_new.rb
@@ -1,11 +1,22 @@
+# Specs for this file can be found on:
+# * spec/lib/gitlab/throttle_spec.rb
+# * spec/requests/rack_attack_global_spec.rb
module Gitlab::Throttle
def self.settings
Gitlab::CurrentSettings.current_application_settings
end
+ # Returns true if we should use the Admin Area protected paths throttle
def self.protected_paths_enabled?
- !self.omnibus_protected_paths_present? &&
- self.settings.throttle_protected_paths_enabled?
+ return false if should_use_omnibus_protected_paths?
+
+ self.settings.throttle_protected_paths_enabled?
+ end
+
+ # To be removed in 13.0: https://gitlab.com/gitlab-org/gitlab/issues/29952
+ def self.should_use_omnibus_protected_paths?
+ !Settings.rack_attack.admin_area_protected_paths_enabled &&
+ self.omnibus_protected_paths_present?
end
def self.omnibus_protected_paths_present?