fatkodima
6cca2467d2
Fix rescuing errors in RedisProxy#increment
2019-12-17 17:54:18 -03:00
Gonzalo Rodriguez
3654293085
Bump gem version to v6.2.1
2019-10-30 15:26:58 -03:00
Gonzalo Rodriguez
e3056e737f
fix: avoid unintended effects on load_config_initializers and other gems load order
...
Because of the sort algorithm rails uses to satisfy `after` and `before`
constraints, gems can have unintended effects on others. See
0a120a818d
Prefer making rack-attack middleware idempotent instead of relying on
the load order and the contents of the middleware stack too much.
closes #452
closes #456
2019-10-29 15:45:26 -03:00
Gonzalo Rodriguez
9bfec1ac70
Bump gem version to v6.2.0
2019-10-12 19:04:46 -03:00
Gonzalo Rodriguez
1167c65ba6
Don't autoplug middleware for untested rails versions
2019-10-12 18:10:10 -03:00
fatkodima
f22b24cbc5
Do not auto-plug for rails < 5
2019-10-08 13:08:07 +03:00
fatkodima
bdfb01ab5b
Changes and tests
2019-10-08 12:29:25 +03:00
fatkodima
b512e05786
Auto plug middleware for simpler installation
2019-10-08 12:29:25 +03:00
Gonzalo Rodriguez
0ce6befd68
style: update to latest rubocop
2019-08-02 17:04:52 -03:00
Gonzalo Rodriguez
c0328707b1
style: enable Style/ParallelAssignment cop checks
2019-08-02 13:47:54 -03:00
Gonzalo Rodriguez
d508e21483
style: avoid multiple assignments to same variable in conditional
2019-08-02 11:59:15 -03:00
Gonzalo Rodriguez
c8021da91c
style: avoid compact class/module definitions
2019-08-02 11:17:41 -03:00
Gonzalo Rodriguez
f5a352b8f9
style: limit line length to 120 columns
2019-08-02 10:51:53 -03:00
Gonzalo Rodriguez
c8abad53fe
Merge remote-tracking branch 'upstream/master'
2019-07-22 15:22:20 -03:00
Gonzalo Rodriguez
dc305e0782
Merge pull request #421 from cristiangreco/cristian/redis-cache-store-failsafe
...
Failsafe on Redis error replies in RedisCacheStoreProxy.
2019-07-15 18:47:17 -03:00
Cristian Greco
dd6c09e581
Failsafe on Redis error replies in RedisCacheStoreProxy.
...
RedisCacheStoreProxy will blow up when RedisCacheStore raises a
CommandError exception. In fact, by default the proxied store only
handles BaseConnectionError exceptions, but will let bubble up any other
type of exception from the underlying client.
This pull request uses the same approach from RedisProxy, where store
operations are wrapped in a `rescuing` block that rescues and ignores
BaseError exceptions (the most generic exception class that can be
raised by the Redis client).
2019-07-14 01:37:59 +01:00
Gonzalo Rodriguez
c3c6398f7e
Bump gem version to v6.1.0
2019-07-11 17:01:40 -03:00
Gonzalo Rodriguez
58ba650e6b
feat: provide discriminator in throttle_data
2019-07-10 17:21:48 -03:00
Gonzalo Rodriguez
6045b82897
Bump version to v6.0.0
2019-04-17 18:44:59 -03:00
Gonzalo Rodriguez
6541634fb0
style: enable Style/Semicolon rubocop
2019-03-01 22:25:27 -03:00
Gonzalo Rodriguez
fcb89a6c12
refactor: avoid unnecessary nil argument passing
2019-03-01 22:22:11 -03:00
Gonzalo Rodriguez
0e8dff4c88
refactor: make Throttle.new consistent with Blocklist/Safelist.new
2019-03-01 22:12:32 -03:00
Gonzalo Rodriguez
5a42fd3ac7
style: enable Style/OptionalArguments rubocop
2019-03-01 21:51:15 -03:00
Gonzalo Rodriguez
2240e8f2c6
style: enable Style/RaiseArgs rubocop
2019-03-01 21:19:06 -03:00
Gonzalo Rodriguez
a0259fb14a
style: enable Style/SingleLineMethods rubocop
2019-03-01 21:14:47 -03:00
Gonzalo Rodriguez
04eeeb9a33
refactor: avoid rescuing pattern repetition
2019-02-28 22:51:57 -03:00
Gonzalo Rodriguez
20d668211e
style: fix Lint/HandleExceptions rubocop
2019-02-28 21:17:36 -03:00
Gonzalo Rodriguez
c67e71defe
style: prefer ruby 1.9+ hash syntax
2019-02-27 23:29:32 -03:00
Gonzalo Rodriguez
8cbd3dc0fc
feat: improve MisconfiguredStoreError exception message to aid debugging
2018-10-11 11:44:10 -03:00
Gonzalo Rodriguez
014f74b95d
Merge pull request #387 from grzuy/fix_redis_3_and_memory_store
...
[Fixes #355 ] Fix unexpected error when using redis 3 and any store which is not proxied
2018-10-08 11:33:34 -03:00
Gonzalo Rodriguez
935f99a638
[ Fixes #355 ] Avoid unexpected 'Gem::LoadError' for redis when not intented to be used
...
It seems that the original implementation accidentally autoloaded ActiveSupport::Cache::RedisCacheStore
which once evaluated asks for redis v4 generating Gem::LoadError.
In order to bypass any unnecessary constant autoloading we can just check class name string.
2018-09-30 22:13:30 -03:00
Gonzalo Rodriguez
91dbb52235
Remove unwrapping
2018-09-30 13:32:08 -03:00
Gonzalo Rodriguez
fc235c90c2
Merge pull request #382 from grzuy/cleanup_redis_cache_store_proxy
...
Remove unnecessary wrapping of ActiveSupport::Cache::RedisCacheStore#read
2018-09-03 23:15:39 -03:00
Gonzalo Rodriguez
55411e5e82
Remove MemCacheProxy which existed only for now obsolete memcache-client
2018-09-03 18:24:21 -03:00
Gonzalo Rodriguez
7001178b6d
Remove unnecessary wrapping of ActiveSupport::Cache::RedisCacheStore#read
...
`raw: true` isn't doing anything special for `read`, only for `write`
2018-09-03 17:55:29 -03:00
Jonathan del Strother
5cdc15b35a
Add a proxy to deal with ActiveSupport::Cache::MemCacheStore
...
If connection pooling is used with AS::Cache::MemCacheStore,
unwrap_active_support_stores wouldn't return the underlying dalli instance(s),
and so Rack::Attack.store would be the bare unproxied MemCacheStore instance.
Calling write then increment would silently fail because :raw wasn't used.
With this commit, we no longer try to unwrap AS::Cache::MemCacheStore instances.
2018-09-03 12:00:02 +01:00
Gonzalo Rodriguez
e295ede874
Use RedisStoreProxy (not RedisProxy) for Redis::Store
2018-06-29 16:48:40 -03:00
Gonzalo Rodriguez
673cf98157
Avoid as much repetition as possible between RedisProxy and RedisStoreProxy
2018-06-29 15:44:41 -03:00
Gonzalo Rodriguez
b40b5718dc
rubocop --auto-correct
2018-06-29 15:41:36 -03:00
Gonzalo Rodriguez
6fbb6c8b1c
Merge branch 'master' into support-redis-gem
2018-06-29 15:40:45 -03:00
Gonzalo Rodriguez
eb07d9789f
Prefer Gem::Version for version comparisons
2018-06-29 15:27:36 -03:00
Gonzalo Rodriguez
85c4c085c9
Remove duplicated #initialize
2018-06-29 15:27:20 -03:00
Gonzalo Rodriguez
d1682b19b4
Merge remote-tracking branch 'rfwatson/master'
2018-06-29 15:24:13 -03:00
Gonzalo Rodriguez
73bc739d5a
Merge remote-tracking branch 'doliveirakn/master'
2018-06-29 11:17:19 -03:00
Gonzalo Rodriguez
8315a1e7e1
Remove support for unmaintained ruby 2.2
2018-06-28 17:08:15 -03:00
Gonzalo Rodriguez
21561bb2f5
Bump version to v5.3.2
2018-06-25 19:27:35 -03:00
Gonzalo Rodriguez
ee84079768
Fix 'redis is not part of the bundle' exception when using :memory_store
...
When RedisCacheStore constant is referenced, activesupport autoloads and
rails tries to require redis, throwing exception if not present
2018-06-25 17:42:45 -03:00
Gonzalo Rodriguez
08861f8d17
Attempt to improve code legibility/clarity/semantics ( #357 )
...
* attempt to improve semantics for legibility
* Attempt to improve legibility by simplifying
* Make it more clear that we're calling procs/blocks here
* Enable rubocop Style/BlockDelimiters cop
* Prefer 'request' over 'req' abbreviation for legibility/clarity
* Instances of Track named 'track' not 'tracker'
2018-06-21 14:33:24 -03:00
Gonzalo Rodriguez
d8b88cfb84
Honor amount argument instead of hard coding counter (part 2)
...
See commit ca2e752937
2018-06-21 11:25:47 -03:00
Gonzalo Rodriguez
196868130a
Bump version to v5.3.1
2018-06-20 19:49:15 -03:00