diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-05-26 10:43:57 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-05-26 10:43:57 +0300 |
commit | 9bb00cd77f5cd2f63d17c4dde56f731061cb36cb (patch) | |
tree | 5f7ef2d44f1f03e61132c45fa792f361a3eacecf /lib | |
parent | d9f4dfe94b5c6a106c16abd4908cb6f2aebafad3 (diff) | |
parent | 3b22cfe6001db636a1750a475821af5f9fa7cf1b (diff) |
Merge branch 'get-monkey-off-my-rack-attack' into 'master'
Remove Rack Attack monkey patches and bump to version 4.3.0
I finally got these monkey patches into Rack Attack v4.3.0, so GitLab no longer needs them. Hooray!
See: https://github.com/kickstarter/rack-attack/pull/128
See merge request !693
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/backend/grack_auth.rb | 1 | ||||
-rw-r--r-- | lib/gitlab/backend/rack_attack_helpers.rb | 31 |
2 files changed, 0 insertions, 32 deletions
diff --git a/lib/gitlab/backend/grack_auth.rb b/lib/gitlab/backend/grack_auth.rb index 050b5ba29dd..03cef30c97d 100644 --- a/lib/gitlab/backend/grack_auth.rb +++ b/lib/gitlab/backend/grack_auth.rb @@ -1,4 +1,3 @@ -require_relative 'rack_attack_helpers' require_relative 'shell_env' module Grack diff --git a/lib/gitlab/backend/rack_attack_helpers.rb b/lib/gitlab/backend/rack_attack_helpers.rb deleted file mode 100644 index 8538f3f6eca..00000000000 --- a/lib/gitlab/backend/rack_attack_helpers.rb +++ /dev/null @@ -1,31 +0,0 @@ -# rack-attack v4.2.0 doesn't yet support clearing of keys. -# Taken from https://github.com/kickstarter/rack-attack/issues/113 -class Rack::Attack::Allow2Ban - def self.reset(discriminator, options) - findtime = options[:findtime] or raise ArgumentError, "Must pass findtime option" - - cache.reset_count("#{key_prefix}:count:#{discriminator}", findtime) - cache.delete("#{key_prefix}:ban:#{discriminator}") - end -end - -class Rack::Attack::Cache - def reset_count(unprefixed_key, period) - epoch_time = Time.now.to_i - # Add 1 to expires_in to avoid timing error: http://git.io/i1PHXA - expires_in = period - (epoch_time % period) + 1 - key = "#{(epoch_time / period).to_i}:#{unprefixed_key}" - delete(key) - end - - def delete(unprefixed_key) - store.delete("#{prefix}:#{unprefixed_key}") - end -end - -class Rack::Attack::StoreProxy::RedisStoreProxy - def delete(key, options={}) - self.del(key) - rescue Redis::BaseError - end -end |