rack-attack 6.2.1 → 6.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55b137d5d1174ac14bcbc494ba7c6753652c23348fef73c5ac712884e299a8d0
4
- data.tar.gz: 9aae493ec090c669ea43f7a5f9bc8a10e6786266477a4dd65b05495c7559e469
3
+ metadata.gz: 5479926deb14a57eebadf44bc0450c119c10c57844e6e887a6536a0dd79ddcc3
4
+ data.tar.gz: a7c6d3162887c8d7e29b7ba390c281be9757c7f9a022c7e705e2029f3d51d091
5
5
  SHA512:
6
- metadata.gz: 2e283d8c8b2e5ffcd99435561230c6019a7a1f9637927d4ca29e0df2c9af9522cb84e60dddd040ab3429b1cc697213d80adb4a9b4cb7587933060ad6e426fabd
7
- data.tar.gz: 1ef81c28f633e8c146a54a0930c706a3158aab568328743e0a3b0953bcbcba0bfb4a32a3e589ea1292c001ec6fd8d52a9c6de3cc4063b466045b692e92d27318
6
+ metadata.gz: 1ff52d16e17933058af32dbe0aeeb704914fb28331f9df3b2bd90fc1820f32f7cd60c9f254506fea6bf1845f850fa72f77dff57fb4a5ecaf4ce619497688bb00
7
+ data.tar.gz: 6f9a3f5adfddc7cd55274c24a7c9a4ff5e498324421abd3ef43cc5707f478a79824c0a5fb14d2a189128a22f42ffc1b144e06bd3bfbfb9e35de60f406edf6793
@@ -31,16 +31,12 @@ module Rack
31
31
  end
32
32
 
33
33
  def increment(key, amount, options = {})
34
- count = nil
35
-
36
34
  rescuing do
37
35
  pipelined do
38
- count = incrby(key, amount)
36
+ incrby(key, amount)
39
37
  expire(key, options[:expires_in]) if options[:expires_in]
40
- end
38
+ end.first
41
39
  end
42
-
43
- count.value if count
44
40
  end
45
41
 
46
42
  def delete(key, _options = {})
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rack
4
4
  class Attack
5
- VERSION = '6.2.1'
5
+ VERSION = '6.2.2'
6
6
  end
7
7
  end
@@ -45,3 +45,15 @@ if defined?(::Dalli)
45
45
  end
46
46
  end
47
47
  end
48
+
49
+ if defined?(Redis)
50
+ describe 'when Redis is offline' do
51
+ include OfflineExamples
52
+
53
+ before do
54
+ @cache = Rack::Attack::Cache.new
55
+ # Use presumably unused port for Redis client
56
+ @cache.store = Redis.new(host: '127.0.0.1', port: 3333)
57
+ end
58
+ end
59
+ end
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: 6.2.1
4
+ version: 6.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Suggs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-30 00:00:00.000000000 Z
11
+ date: 2019-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -204,7 +204,6 @@ extra_rdoc_files: []
204
204
  files:
205
205
  - README.md
206
206
  - Rakefile
207
- - bin/setup
208
207
  - lib/rack/attack.rb
209
208
  - lib/rack/attack/allow2ban.rb
210
209
  - lib/rack/attack/blocklist.rb
@@ -290,50 +289,50 @@ required_rubygems_version: !ruby/object:Gem::Requirement
290
289
  - !ruby/object:Gem::Version
291
290
  version: '0'
292
291
  requirements: []
293
- rubygems_version: 3.0.6
292
+ rubygems_version: 3.1.1
294
293
  signing_key:
295
294
  specification_version: 4
296
295
  summary: Block & throttle abusive requests
297
296
  test_files:
297
+ - spec/rack_attack_spec.rb
298
+ - spec/fail2ban_spec.rb
299
+ - spec/allow2ban_spec.rb
300
+ - spec/support/cache_store_helper.rb
301
+ - spec/rack_attack_instrumentation_spec.rb
302
+ - spec/rack_attack_throttle_spec.rb
298
303
  - spec/integration/offline_spec.rb
299
- - spec/rack_attack_path_normalizer_spec.rb
300
- - spec/acceptance/safelisting_subnet_spec.rb
304
+ - spec/rack_attack_dalli_proxy_spec.rb
305
+ - spec/acceptance/fail2ban_spec.rb
306
+ - spec/acceptance/allow2ban_spec.rb
301
307
  - spec/acceptance/rails_middleware_spec.rb
308
+ - spec/acceptance/throttling_spec.rb
302
309
  - spec/acceptance/track_throttle_spec.rb
303
- - spec/acceptance/cache_store_config_for_fail2ban_spec.rb
304
- - spec/acceptance/cache_store_config_with_rails_spec.rb
305
- - spec/acceptance/cache_store_config_for_allow2ban_spec.rb
306
- - spec/acceptance/safelisting_ip_spec.rb
307
- - spec/acceptance/track_spec.rb
308
310
  - spec/acceptance/blocking_subnet_spec.rb
309
311
  - spec/acceptance/blocking_ip_spec.rb
310
- - spec/acceptance/allow2ban_spec.rb
311
- - spec/acceptance/throttling_spec.rb
312
- - spec/acceptance/blocking_spec.rb
313
- - spec/acceptance/customizing_throttled_response_spec.rb
312
+ - spec/acceptance/cache_store_config_with_rails_spec.rb
313
+ - spec/acceptance/cache_store_config_for_fail2ban_spec.rb
314
+ - spec/acceptance/safelisting_subnet_spec.rb
314
315
  - spec/acceptance/extending_request_object_spec.rb
315
316
  - spec/acceptance/safelisting_spec.rb
317
+ - spec/acceptance/customizing_throttled_response_spec.rb
318
+ - spec/acceptance/safelisting_ip_spec.rb
319
+ - spec/acceptance/cache_store_config_for_allow2ban_spec.rb
320
+ - spec/acceptance/customizing_blocked_response_spec.rb
316
321
  - spec/acceptance/cache_store_config_for_throttle_spec.rb
317
- - spec/acceptance/fail2ban_spec.rb
318
- - spec/acceptance/stores/active_support_mem_cache_store_pooled_spec.rb
319
- - spec/acceptance/stores/active_support_redis_cache_store_spec.rb
320
- - spec/acceptance/stores/active_support_memory_store_spec.rb
321
- - spec/acceptance/stores/active_support_redis_store_spec.rb
322
- - spec/acceptance/stores/active_support_mem_cache_store_spec.rb
322
+ - spec/acceptance/blocking_spec.rb
323
+ - spec/acceptance/stores/redis_spec.rb
323
324
  - spec/acceptance/stores/active_support_redis_cache_store_pooled_spec.rb
325
+ - spec/acceptance/stores/active_support_memory_store_spec.rb
324
326
  - spec/acceptance/stores/connection_pool_dalli_client_spec.rb
327
+ - spec/acceptance/stores/active_support_redis_cache_store_spec.rb
325
328
  - spec/acceptance/stores/active_support_dalli_store_spec.rb
326
- - spec/acceptance/stores/redis_store_spec.rb
329
+ - spec/acceptance/stores/active_support_mem_cache_store_pooled_spec.rb
330
+ - spec/acceptance/stores/active_support_mem_cache_store_spec.rb
327
331
  - spec/acceptance/stores/dalli_client_spec.rb
328
- - spec/acceptance/stores/redis_spec.rb
329
- - spec/acceptance/customizing_blocked_response_spec.rb
330
- - spec/spec_helper.rb
331
- - spec/allow2ban_spec.rb
332
- - spec/rack_attack_instrumentation_spec.rb
333
- - spec/rack_attack_dalli_proxy_spec.rb
334
- - spec/rack_attack_spec.rb
335
- - spec/rack_attack_throttle_spec.rb
332
+ - spec/acceptance/stores/redis_store_spec.rb
333
+ - spec/acceptance/stores/active_support_redis_store_spec.rb
334
+ - spec/acceptance/track_spec.rb
335
+ - spec/rack_attack_path_normalizer_spec.rb
336
336
  - spec/rack_attack_request_spec.rb
337
- - spec/fail2ban_spec.rb
338
337
  - spec/rack_attack_track_spec.rb
339
- - spec/support/cache_store_helper.rb
338
+ - spec/spec_helper.rb
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here