rack-attack 5.3.1 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/Rakefile +3 -2
  4. data/lib/rack/attack.rb +23 -22
  5. data/lib/rack/attack/cache.rb +4 -3
  6. data/lib/rack/attack/check.rb +6 -8
  7. data/lib/rack/attack/store_proxy.rb +1 -1
  8. data/lib/rack/attack/store_proxy/redis_cache_store_proxy.rb +2 -2
  9. data/lib/rack/attack/store_proxy/redis_proxy.rb +54 -0
  10. data/lib/rack/attack/store_proxy/redis_store_proxy.rb +1 -22
  11. data/lib/rack/attack/throttle.rb +14 -11
  12. data/lib/rack/attack/track.rb +3 -3
  13. data/lib/rack/attack/version.rb +1 -1
  14. data/spec/acceptance/stores/active_support_dalli_store_spec.rb +41 -0
  15. data/spec/acceptance/stores/active_support_mem_cache_store_spec.rb +40 -0
  16. data/spec/acceptance/stores/{mem_cache_store_spec.rb → active_support_memory_store_spec.rb} +5 -5
  17. data/spec/acceptance/stores/{redis_cache_store_pooled_spec.rb → active_support_redis_cache_store_pooled_spec.rb} +4 -4
  18. data/spec/acceptance/stores/{redis_cache_store_spec.rb → active_support_redis_cache_store_spec.rb} +4 -4
  19. data/spec/acceptance/stores/active_support_redis_store_spec.rb +40 -0
  20. data/spec/acceptance/stores/connection_pool_dalli_client_spec.rb +42 -0
  21. data/spec/acceptance/stores/dalli_client_spec.rb +41 -0
  22. data/spec/acceptance/stores/redis_spec.rb +42 -0
  23. data/spec/acceptance/stores/redis_store_spec.rb +40 -0
  24. data/spec/integration/offline_spec.rb +21 -19
  25. data/spec/rack_attack_throttle_spec.rb +4 -4
  26. data/spec/rack_attack_track_spec.rb +4 -4
  27. data/spec/spec_helper.rb +15 -9
  28. metadata +84 -146
  29. data/spec/integration/rack_attack_cache_spec.rb +0 -124
@@ -3,13 +3,13 @@ require_relative "../../support/cache_store_helper"
3
3
 
4
4
  require "timecop"
5
5
 
6
- describe "MemCacheStore as a cache backend" do
6
+ describe "ActiveSupport::Cache::MemoryStore as a cache backend" do
7
7
  before do
8
- Rack::Attack.cache.store = ActiveSupport::Cache::MemCacheStore.new
8
+ Rack::Attack.cache.store = ActiveSupport::Cache::MemoryStore.new
9
9
  end
10
10
 
11
11
  after do
12
- Rack::Attack.cache.store.flush_all
12
+ Rack::Attack.cache.store.clear
13
13
  end
14
14
 
15
15
  it_works_for_cache_backed_features
@@ -29,10 +29,10 @@ describe "MemCacheStore as a cache backend" do
29
29
  get "/", {}, "REMOTE_ADDR" => "1.2.3.4"
30
30
  end
31
31
 
32
- assert Rack::Attack.cache.store.get(key)
32
+ assert Rack::Attack.cache.store.fetch(key)
33
33
 
34
34
  sleep 2.1
35
35
 
36
- assert_nil Rack::Attack.cache.store.get(key)
36
+ assert_nil Rack::Attack.cache.store.fetch(key)
37
37
  end
38
38
  end
@@ -1,10 +1,10 @@
1
1
  require_relative "../../spec_helper"
2
- require_relative "../../support/cache_store_helper"
3
2
 
4
- require "timecop"
3
+ if defined?(::ConnectionPool) && defined?(::Redis) && defined?(::ActiveSupport::Cache::RedisCacheStore)
4
+ require_relative "../../support/cache_store_helper"
5
+ require "timecop"
5
6
 
6
- if ActiveSupport.version >= Gem::Version.new("5.2.0")
7
- describe "RedisCacheStore (pooled) as a cache backend" do
7
+ describe "ActiveSupport::Cache::RedisCacheStore (pooled) as a cache backend" do
8
8
  before do
9
9
  Rack::Attack.cache.store = ActiveSupport::Cache::RedisCacheStore.new(pool_size: 2)
10
10
  end
@@ -1,10 +1,10 @@
1
1
  require_relative "../../spec_helper"
2
- require_relative "../../support/cache_store_helper"
3
2
 
4
- require "timecop"
3
+ if defined?(::Redis) && defined?(::ActiveSupport::Cache::RedisCacheStore)
4
+ require_relative "../../support/cache_store_helper"
5
+ require "timecop"
5
6
 
6
- if ActiveSupport.version >= Gem::Version.new("5.2.0")
7
- describe "RedisCacheStore as a cache backend" do
7
+ describe "ActiveSupport::Cache::RedisCacheStore as a cache backend" do
8
8
  before do
9
9
  Rack::Attack.cache.store = ActiveSupport::Cache::RedisCacheStore.new
10
10
  end
@@ -0,0 +1,40 @@
1
+ require_relative "../../spec_helper"
2
+
3
+ if defined?(::ActiveSupport::Cache::RedisStore)
4
+ require_relative "../../support/cache_store_helper"
5
+ require "timecop"
6
+
7
+ describe "ActiveSupport::Cache::RedisStore as a cache backend" do
8
+ before do
9
+ Rack::Attack.cache.store = ActiveSupport::Cache::RedisStore.new
10
+ end
11
+
12
+ after do
13
+ Rack::Attack.cache.store.flushdb
14
+ end
15
+
16
+ it_works_for_cache_backed_features
17
+
18
+ it "doesn't leak keys" do
19
+ Rack::Attack.throttle("by ip", limit: 1, period: 1) do |request|
20
+ request.ip
21
+ end
22
+
23
+ key = nil
24
+
25
+ # Freeze time during these statement to be sure that the key used by rack attack is the same
26
+ # we pre-calculate in local variable `key`
27
+ Timecop.freeze do
28
+ key = "rack::attack:#{Time.now.to_i}:by ip:1.2.3.4"
29
+
30
+ get "/", {}, "REMOTE_ADDR" => "1.2.3.4"
31
+ end
32
+
33
+ assert Rack::Attack.cache.store.read(key)
34
+
35
+ sleep 2.1
36
+
37
+ assert_nil Rack::Attack.cache.store.read(key)
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,42 @@
1
+ require_relative "../../spec_helper"
2
+
3
+ if defined?(::Dalli) && defined?(::ConnectionPool)
4
+ require_relative "../../support/cache_store_helper"
5
+ require "connection_pool"
6
+ require "dalli"
7
+ require "timecop"
8
+
9
+ describe "ConnectionPool with Dalli::Client as a cache backend" do
10
+ before do
11
+ Rack::Attack.cache.store = ConnectionPool.new { Dalli::Client.new }
12
+ end
13
+
14
+ after do
15
+ Rack::Attack.cache.store.with { |client| client.flush_all }
16
+ end
17
+
18
+ it_works_for_cache_backed_features
19
+
20
+ it "doesn't leak keys" do
21
+ Rack::Attack.throttle("by ip", limit: 1, period: 1) do |request|
22
+ request.ip
23
+ end
24
+
25
+ key = nil
26
+
27
+ # Freeze time during these statement to be sure that the key used by rack attack is the same
28
+ # we pre-calculate in local variable `key`
29
+ Timecop.freeze do
30
+ key = "rack::attack:#{Time.now.to_i}:by ip:1.2.3.4"
31
+
32
+ get "/", {}, "REMOTE_ADDR" => "1.2.3.4"
33
+ end
34
+
35
+ assert(Rack::Attack.cache.store.with { |client| client.fetch(key) })
36
+
37
+ sleep 2.1
38
+
39
+ assert_nil(Rack::Attack.cache.store.with { |client| client.fetch(key) })
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,41 @@
1
+ require_relative "../../spec_helper"
2
+
3
+ if defined?(::Dalli)
4
+ require_relative "../../support/cache_store_helper"
5
+ require "dalli"
6
+ require "timecop"
7
+
8
+ describe "Dalli::Client as a cache backend" do
9
+ before do
10
+ Rack::Attack.cache.store = Dalli::Client.new
11
+ end
12
+
13
+ after do
14
+ Rack::Attack.cache.store.flush_all
15
+ end
16
+
17
+ it_works_for_cache_backed_features
18
+
19
+ it "doesn't leak keys" do
20
+ Rack::Attack.throttle("by ip", limit: 1, period: 1) do |request|
21
+ request.ip
22
+ end
23
+
24
+ key = nil
25
+
26
+ # Freeze time during these statement to be sure that the key used by rack attack is the same
27
+ # we pre-calculate in local variable `key`
28
+ Timecop.freeze do
29
+ key = "rack::attack:#{Time.now.to_i}:by ip:1.2.3.4"
30
+
31
+ get "/", {}, "REMOTE_ADDR" => "1.2.3.4"
32
+ end
33
+
34
+ assert Rack::Attack.cache.store.fetch(key)
35
+
36
+ sleep 2.1
37
+
38
+ assert_nil Rack::Attack.cache.store.fetch(key)
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../spec_helper"
4
+
5
+ if defined?(::Redis)
6
+ require_relative "../../support/cache_store_helper"
7
+ require "timecop"
8
+
9
+ describe "Plain redis as a cache backend" do
10
+ before do
11
+ Rack::Attack.cache.store = Redis.new
12
+ end
13
+
14
+ after do
15
+ Rack::Attack.cache.store.flushdb
16
+ end
17
+
18
+ it_works_for_cache_backed_features
19
+
20
+ it "doesn't leak keys" do
21
+ Rack::Attack.throttle("by ip", limit: 1, period: 1) do |request|
22
+ request.ip
23
+ end
24
+
25
+ key = nil
26
+
27
+ # Freeze time during these statement to be sure that the key used by rack attack is the same
28
+ # we pre-calculate in local variable `key`
29
+ Timecop.freeze do
30
+ key = "rack::attack:#{Time.now.to_i}:by ip:1.2.3.4"
31
+
32
+ get "/", {}, "REMOTE_ADDR" => "1.2.3.4"
33
+ end
34
+
35
+ assert Rack::Attack.cache.store.get(key)
36
+
37
+ sleep 2.1
38
+
39
+ assert_nil Rack::Attack.cache.store.get(key)
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,40 @@
1
+ require_relative "../../spec_helper"
2
+ require_relative "../../support/cache_store_helper"
3
+
4
+ if defined?(::Redis::Store)
5
+ require "timecop"
6
+
7
+ describe "ActiveSupport::Cache::RedisStore as a cache backend" do
8
+ before do
9
+ Rack::Attack.cache.store = ::Redis::Store.new
10
+ end
11
+
12
+ after do
13
+ Rack::Attack.cache.store.flushdb
14
+ end
15
+
16
+ it_works_for_cache_backed_features
17
+
18
+ it "doesn't leak keys" do
19
+ Rack::Attack.throttle("by ip", limit: 1, period: 1) do |request|
20
+ request.ip
21
+ end
22
+
23
+ key = nil
24
+
25
+ # Freeze time during these statement to be sure that the key used by rack attack is the same
26
+ # we pre-calculate in local variable `key`
27
+ Timecop.freeze do
28
+ key = "rack::attack:#{Time.now.to_i}:by ip:1.2.3.4"
29
+
30
+ get "/", {}, "REMOTE_ADDR" => "1.2.3.4"
31
+ end
32
+
33
+ assert Rack::Attack.cache.store.read(key)
34
+
35
+ sleep 2.1
36
+
37
+ assert_nil Rack::Attack.cache.store.read(key)
38
+ end
39
+ end
40
+ end
@@ -1,6 +1,4 @@
1
1
  require 'active_support/cache'
2
- require 'redis-activesupport'
3
- require 'dalli'
4
2
  require_relative '../spec_helper'
5
3
 
6
4
  OfflineExamples = Minitest::SharedExamples.new do
@@ -17,27 +15,31 @@ OfflineExamples = Minitest::SharedExamples.new do
17
15
  end
18
16
  end
19
17
 
20
- describe 'when Redis is offline' do
21
- include OfflineExamples
18
+ if defined?(::ActiveSupport::Cache::RedisStore)
19
+ describe 'when Redis is offline' do
20
+ include OfflineExamples
22
21
 
23
- before {
24
- @cache = Rack::Attack::Cache.new
25
- # Use presumably unused port for Redis client
26
- @cache.store = ActiveSupport::Cache::RedisStore.new(:host => '127.0.0.1', :port => 3333)
27
- }
22
+ before do
23
+ @cache = Rack::Attack::Cache.new
24
+ # Use presumably unused port for Redis client
25
+ @cache.store = ActiveSupport::Cache::RedisStore.new(:host => '127.0.0.1', :port => 3333)
26
+ end
27
+ end
28
28
  end
29
29
 
30
- describe 'when Memcached is offline' do
31
- include OfflineExamples
30
+ if defined?(::Dalli)
31
+ describe 'when Memcached is offline' do
32
+ include OfflineExamples
32
33
 
33
- before {
34
- Dalli.logger.level = Logger::FATAL
34
+ before do
35
+ Dalli.logger.level = Logger::FATAL
35
36
 
36
- @cache = Rack::Attack::Cache.new
37
- @cache.store = Dalli::Client.new('127.0.0.1:22122')
38
- }
37
+ @cache = Rack::Attack::Cache.new
38
+ @cache.store = Dalli::Client.new('127.0.0.1:22122')
39
+ end
39
40
 
40
- after {
41
- Dalli.logger.level = Logger::INFO
42
- }
41
+ after do
42
+ Dalli.logger.level = Logger::INFO
43
+ end
44
+ end
43
45
  end
@@ -20,7 +20,7 @@ describe 'Rack::Attack.throttle' do
20
20
  end
21
21
 
22
22
  it 'should populate throttle data' do
23
- data = { :count => 1, :limit => 1, :period => @period }
23
+ data = { :count => 1, :limit => 1, :period => @period, epoch_time: Rack::Attack.cache.last_epoch_time.to_i }
24
24
  last_request.env['rack.attack.throttle_data']['ip/sec'].must_equal data
25
25
  end
26
26
  end
@@ -37,7 +37,7 @@ describe 'Rack::Attack.throttle' do
37
37
  it 'should tag the env' do
38
38
  last_request.env['rack.attack.matched'].must_equal 'ip/sec'
39
39
  last_request.env['rack.attack.match_type'].must_equal :throttle
40
- last_request.env['rack.attack.match_data'].must_equal(:count => 2, :limit => 1, :period => @period)
40
+ last_request.env['rack.attack.match_data'].must_equal(:count => 2, :limit => 1, :period => @period, epoch_time: Rack::Attack.cache.last_epoch_time.to_i)
41
41
  last_request.env['rack.attack.match_discriminator'].must_equal('1.2.3.4')
42
42
  end
43
43
 
@@ -65,7 +65,7 @@ describe 'Rack::Attack.throttle with limit as proc' do
65
65
  end
66
66
 
67
67
  it 'should populate throttle data' do
68
- data = { :count => 1, :limit => 1, :period => @period }
68
+ data = { :count => 1, :limit => 1, :period => @period, epoch_time: Rack::Attack.cache.last_epoch_time.to_i }
69
69
  last_request.env['rack.attack.throttle_data']['ip/sec'].must_equal data
70
70
  end
71
71
  end
@@ -89,7 +89,7 @@ describe 'Rack::Attack.throttle with period as proc' do
89
89
  end
90
90
 
91
91
  it 'should populate throttle data' do
92
- data = { :count => 1, :limit => 1, :period => @period }
92
+ data = { :count => 1, :limit => 1, :period => @period, epoch_time: Rack::Attack.cache.last_epoch_time.to_i }
93
93
  last_request.env['rack.attack.throttle_data']['ip/sec'].must_equal data
94
94
  end
95
95
  end
@@ -47,15 +47,15 @@ describe 'Rack::Attack.track' do
47
47
 
48
48
  describe "without limit and period options" do
49
49
  it "should assign the track filter to a Check instance" do
50
- tracker = Rack::Attack.track("homepage") { |req| req.path == "/" }
51
- tracker.filter.class.must_equal Rack::Attack::Check
50
+ track = Rack::Attack.track("homepage") { |req| req.path == "/" }
51
+ track.filter.class.must_equal Rack::Attack::Check
52
52
  end
53
53
  end
54
54
 
55
55
  describe "with limit and period options" do
56
56
  it "should assign the track filter to a Throttle instance" do
57
- tracker = Rack::Attack.track("homepage", :limit => 10, :period => 10) { |req| req.path == "/" }
58
- tracker.filter.class.must_equal Rack::Attack::Throttle
57
+ track = Rack::Attack.track("homepage", :limit => 10, :period => 10) { |req| req.path == "/" }
58
+ track.filter.class.must_equal Rack::Attack::Throttle
59
59
  end
60
60
  end
61
61
  end
@@ -1,4 +1,3 @@
1
- require "rubygems"
2
1
  require "bundler/setup"
3
2
 
4
3
  require "minitest/autorun"
@@ -9,16 +8,23 @@ require 'action_dispatch'
9
8
 
10
9
  require "rack/attack"
11
10
 
12
- begin
13
- require 'pry'
14
- rescue LoadError
15
- # nothing to do here
16
- end
17
-
18
11
  if RUBY_ENGINE == "ruby"
19
12
  require "byebug"
20
13
  end
21
14
 
15
+ def safe_require(name)
16
+ begin
17
+ require name
18
+ rescue LoadError
19
+ end
20
+ end
21
+
22
+ safe_require "connection_pool"
23
+ safe_require "dalli"
24
+ safe_require "redis"
25
+ safe_require "redis-activesupport"
26
+ safe_require "redis-store"
27
+
22
28
  class MiniTest::Spec
23
29
  include Rack::Test::Methods
24
30
 
@@ -36,14 +42,14 @@ class MiniTest::Spec
36
42
  end
37
43
 
38
44
  def app
39
- Rack::Builder.new {
45
+ Rack::Builder.new do
40
46
  # Use Rack::Lint to test that rack-attack is complying with the rack spec
41
47
  use Rack::Lint
42
48
  use Rack::Attack
43
49
  use Rack::Lint
44
50
 
45
51
  run lambda { |_env| [200, {}, ['Hello World']] }
46
- }.to_app
52
+ end.to_app
47
53
  end
48
54
 
49
55
  def self.it_allows_ok_requests
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-attack
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.1
4
+ version: 5.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Suggs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-20 00:00:00.000000000 Z
11
+ date: 2018-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -16,252 +16,174 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
19
+ version: '1.0'
20
+ - - "<"
25
21
  - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: actionpack
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 3.0.0
34
- type: :development
22
+ version: '3'
23
+ type: :runtime
35
24
  prerelease: false
36
25
  version_requirements: !ruby/object:Gem::Requirement
37
26
  requirements:
38
27
  - - ">="
39
28
  - !ruby/object:Gem::Version
40
- version: 3.0.0
41
- - !ruby/object:Gem::Dependency
42
- name: activesupport
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
29
+ version: '1.0'
30
+ - - "<"
46
31
  - !ruby/object:Gem::Version
47
- version: 3.0.0
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: 3.0.0
32
+ version: '3'
55
33
  - !ruby/object:Gem::Dependency
56
34
  name: appraisal
57
35
  requirement: !ruby/object:Gem::Requirement
58
36
  requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: connection_pool
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: dalli
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: guard-minitest
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
37
+ - - "~>"
102
38
  - !ruby/object:Gem::Version
103
- version: '0'
39
+ version: '2.2'
104
40
  type: :development
105
41
  prerelease: false
106
42
  version_requirements: !ruby/object:Gem::Requirement
107
43
  requirements:
108
- - - ">="
44
+ - - "~>"
109
45
  - !ruby/object:Gem::Version
110
- version: '0'
46
+ version: '2.2'
111
47
  - !ruby/object:Gem::Dependency
112
- name: memcache-client
48
+ name: bundler
113
49
  requirement: !ruby/object:Gem::Requirement
114
50
  requirements:
115
- - - ">="
51
+ - - "~>"
116
52
  - !ruby/object:Gem::Version
117
- version: '0'
53
+ version: '1.16'
118
54
  type: :development
119
55
  prerelease: false
120
56
  version_requirements: !ruby/object:Gem::Requirement
121
57
  requirements:
122
- - - ">="
58
+ - - "~>"
123
59
  - !ruby/object:Gem::Version
124
- version: '0'
60
+ version: '1.16'
125
61
  - !ruby/object:Gem::Dependency
126
62
  name: minitest
127
63
  requirement: !ruby/object:Gem::Requirement
128
64
  requirements:
129
- - - ">="
65
+ - - "~>"
130
66
  - !ruby/object:Gem::Version
131
- version: '0'
67
+ version: '5.11'
132
68
  type: :development
133
69
  prerelease: false
134
70
  version_requirements: !ruby/object:Gem::Requirement
135
71
  requirements:
136
- - - ">="
72
+ - - "~>"
137
73
  - !ruby/object:Gem::Version
138
- version: '0'
74
+ version: '5.11'
139
75
  - !ruby/object:Gem::Dependency
140
76
  name: minitest-stub-const
141
77
  requirement: !ruby/object:Gem::Requirement
142
78
  requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: pry
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
79
+ - - "~>"
158
80
  - !ruby/object:Gem::Version
159
- version: '0'
81
+ version: '0.6'
160
82
  type: :development
161
83
  prerelease: false
162
84
  version_requirements: !ruby/object:Gem::Requirement
163
85
  requirements:
164
- - - ">="
86
+ - - "~>"
165
87
  - !ruby/object:Gem::Version
166
- version: '0'
88
+ version: '0.6'
167
89
  - !ruby/object:Gem::Dependency
168
90
  name: rack-test
169
91
  requirement: !ruby/object:Gem::Requirement
170
92
  requirements:
171
- - - ">="
93
+ - - "~>"
172
94
  - !ruby/object:Gem::Version
173
- version: '0'
95
+ version: '1.0'
174
96
  type: :development
175
97
  prerelease: false
176
98
  version_requirements: !ruby/object:Gem::Requirement
177
99
  requirements:
178
- - - ">="
100
+ - - "~>"
179
101
  - !ruby/object:Gem::Version
180
- version: '0'
102
+ version: '1.0'
181
103
  - !ruby/object:Gem::Dependency
182
104
  name: rake
183
105
  requirement: !ruby/object:Gem::Requirement
184
106
  requirements:
185
- - - ">="
107
+ - - "~>"
186
108
  - !ruby/object:Gem::Version
187
- version: '0'
109
+ version: '12.3'
188
110
  type: :development
189
111
  prerelease: false
190
112
  version_requirements: !ruby/object:Gem::Requirement
191
113
  requirements:
192
- - - ">="
114
+ - - "~>"
193
115
  - !ruby/object:Gem::Version
194
- version: '0'
116
+ version: '12.3'
195
117
  - !ruby/object:Gem::Dependency
196
- name: redis-activesupport
118
+ name: rubocop
197
119
  requirement: !ruby/object:Gem::Requirement
198
120
  requirements:
199
- - - ">="
121
+ - - '='
200
122
  - !ruby/object:Gem::Version
201
- version: '0'
123
+ version: 0.57.2
202
124
  type: :development
203
125
  prerelease: false
204
126
  version_requirements: !ruby/object:Gem::Requirement
205
127
  requirements:
206
- - - ">="
128
+ - - '='
207
129
  - !ruby/object:Gem::Version
208
- version: '0'
130
+ version: 0.57.2
209
131
  - !ruby/object:Gem::Dependency
210
- name: rubocop
132
+ name: timecop
211
133
  requirement: !ruby/object:Gem::Requirement
212
134
  requirements:
213
- - - '='
135
+ - - "~>"
214
136
  - !ruby/object:Gem::Version
215
- version: 0.57.2
137
+ version: 0.9.1
216
138
  type: :development
217
139
  prerelease: false
218
140
  version_requirements: !ruby/object:Gem::Requirement
219
141
  requirements:
220
- - - '='
142
+ - - "~>"
221
143
  - !ruby/object:Gem::Version
222
- version: 0.57.2
144
+ version: 0.9.1
223
145
  - !ruby/object:Gem::Dependency
224
- name: timecop
146
+ name: byebug
225
147
  requirement: !ruby/object:Gem::Requirement
226
148
  requirements:
227
- - - ">="
149
+ - - "~>"
228
150
  - !ruby/object:Gem::Version
229
- version: '0'
151
+ version: '10.0'
230
152
  type: :development
231
153
  prerelease: false
232
154
  version_requirements: !ruby/object:Gem::Requirement
233
155
  requirements:
234
- - - ">="
156
+ - - "~>"
235
157
  - !ruby/object:Gem::Version
236
- version: '0'
158
+ version: '10.0'
237
159
  - !ruby/object:Gem::Dependency
238
- name: guard
160
+ name: actionpack
239
161
  requirement: !ruby/object:Gem::Requirement
240
162
  requirements:
241
- - - ">="
163
+ - - "~>"
242
164
  - !ruby/object:Gem::Version
243
- version: '0'
165
+ version: '5.2'
244
166
  type: :development
245
167
  prerelease: false
246
168
  version_requirements: !ruby/object:Gem::Requirement
247
169
  requirements:
248
- - - ">="
170
+ - - "~>"
249
171
  - !ruby/object:Gem::Version
250
- version: '0'
172
+ version: '5.2'
251
173
  - !ruby/object:Gem::Dependency
252
- name: byebug
174
+ name: activesupport
253
175
  requirement: !ruby/object:Gem::Requirement
254
176
  requirements:
255
- - - ">="
177
+ - - "~>"
256
178
  - !ruby/object:Gem::Version
257
- version: '0'
179
+ version: '5.2'
258
180
  type: :development
259
181
  prerelease: false
260
182
  version_requirements: !ruby/object:Gem::Requirement
261
183
  requirements:
262
- - - ">="
184
+ - - "~>"
263
185
  - !ruby/object:Gem::Version
264
- version: '0'
186
+ version: '5.2'
265
187
  description: A rack middleware for throttling and blocking abusive requests
266
188
  email: aaron@ktheory.com
267
189
  executables: []
@@ -283,6 +205,7 @@ files:
283
205
  - lib/rack/attack/store_proxy/dalli_proxy.rb
284
206
  - lib/rack/attack/store_proxy/mem_cache_proxy.rb
285
207
  - lib/rack/attack/store_proxy/redis_cache_store_proxy.rb
208
+ - lib/rack/attack/store_proxy/redis_proxy.rb
286
209
  - lib/rack/attack/store_proxy/redis_store_proxy.rb
287
210
  - lib/rack/attack/throttle.rb
288
211
  - lib/rack/attack/track.rb
@@ -302,16 +225,22 @@ files:
302
225
  - spec/acceptance/safelisting_ip_spec.rb
303
226
  - spec/acceptance/safelisting_spec.rb
304
227
  - spec/acceptance/safelisting_subnet_spec.rb
305
- - spec/acceptance/stores/mem_cache_store_spec.rb
306
- - spec/acceptance/stores/redis_cache_store_pooled_spec.rb
307
- - spec/acceptance/stores/redis_cache_store_spec.rb
228
+ - spec/acceptance/stores/active_support_dalli_store_spec.rb
229
+ - spec/acceptance/stores/active_support_mem_cache_store_spec.rb
230
+ - spec/acceptance/stores/active_support_memory_store_spec.rb
231
+ - spec/acceptance/stores/active_support_redis_cache_store_pooled_spec.rb
232
+ - spec/acceptance/stores/active_support_redis_cache_store_spec.rb
233
+ - spec/acceptance/stores/active_support_redis_store_spec.rb
234
+ - spec/acceptance/stores/connection_pool_dalli_client_spec.rb
235
+ - spec/acceptance/stores/dalli_client_spec.rb
236
+ - spec/acceptance/stores/redis_spec.rb
237
+ - spec/acceptance/stores/redis_store_spec.rb
308
238
  - spec/acceptance/throttling_spec.rb
309
239
  - spec/acceptance/track_spec.rb
310
240
  - spec/acceptance/track_throttle_spec.rb
311
241
  - spec/allow2ban_spec.rb
312
242
  - spec/fail2ban_spec.rb
313
243
  - spec/integration/offline_spec.rb
314
- - spec/integration/rack_attack_cache_spec.rb
315
244
  - spec/rack_attack_dalli_proxy_spec.rb
316
245
  - spec/rack_attack_path_normalizer_spec.rb
317
246
  - spec/rack_attack_request_spec.rb
@@ -323,7 +252,10 @@ files:
323
252
  homepage: https://github.com/kickstarter/rack-attack
324
253
  licenses:
325
254
  - MIT
326
- metadata: {}
255
+ metadata:
256
+ bug_tracker_uri: https://github.com/kickstarter/rack-attack/issues
257
+ changelog_uri: https://github.com/kickstarter/rack-attack/blob/master/CHANGELOG.md
258
+ source_code_uri: https://github.com/kickstarter/rack-attack
327
259
  post_install_message:
328
260
  rdoc_options:
329
261
  - "--charset=UTF-8"
@@ -347,7 +279,6 @@ specification_version: 4
347
279
  summary: Block & throttle abusive requests
348
280
  test_files:
349
281
  - spec/integration/offline_spec.rb
350
- - spec/integration/rack_attack_cache_spec.rb
351
282
  - spec/rack_attack_path_normalizer_spec.rb
352
283
  - spec/acceptance/safelisting_subnet_spec.rb
353
284
  - spec/acceptance/track_throttle_spec.rb
@@ -366,9 +297,16 @@ test_files:
366
297
  - spec/acceptance/safelisting_spec.rb
367
298
  - spec/acceptance/cache_store_config_for_throttle_spec.rb
368
299
  - spec/acceptance/fail2ban_spec.rb
369
- - spec/acceptance/stores/mem_cache_store_spec.rb
370
- - spec/acceptance/stores/redis_cache_store_spec.rb
371
- - spec/acceptance/stores/redis_cache_store_pooled_spec.rb
300
+ - spec/acceptance/stores/active_support_redis_cache_store_spec.rb
301
+ - spec/acceptance/stores/active_support_memory_store_spec.rb
302
+ - spec/acceptance/stores/active_support_redis_store_spec.rb
303
+ - spec/acceptance/stores/active_support_mem_cache_store_spec.rb
304
+ - spec/acceptance/stores/active_support_redis_cache_store_pooled_spec.rb
305
+ - spec/acceptance/stores/connection_pool_dalli_client_spec.rb
306
+ - spec/acceptance/stores/active_support_dalli_store_spec.rb
307
+ - spec/acceptance/stores/redis_store_spec.rb
308
+ - spec/acceptance/stores/dalli_client_spec.rb
309
+ - spec/acceptance/stores/redis_spec.rb
372
310
  - spec/acceptance/customizing_blocked_response_spec.rb
373
311
  - spec/spec_helper.rb
374
312
  - spec/allow2ban_spec.rb