rack-dedos 0.4.2 → 0.5.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +2 -2
- data/lib/rack/dedos/filters/base.rb +1 -1
- data/lib/rack/dedos/filters/country.rb +4 -0
- data/lib/rack/dedos/filters/user_agent.rb +4 -0
- data/lib/rack/dedos/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ec975fa6b00c228589811832180fae90d61ba898ef4b08881c9f7897d06ee4d1
|
|
4
|
+
data.tar.gz: 51d214aa83afb5fb9c3d1397be8ef7ba35c26bf9dfc77a0dd1d9ea3b69864558
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 20594ffae8646abd32f009a6bf203cc464720489e60885e1ebd60e60054c84c0ad0563c3f50dc7e248277bbc239db8592c699faf1e5c395f71572da4ef08ff78
|
|
7
|
+
data.tar.gz: 859501a8bb90c6823c413b4bc30bb597491699eb009820e9d61875eee15e4e4f970225bd66b8206cd81c78f24fa8f1cd97a355b070222dee78db0e7543833290
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -94,11 +94,11 @@ Given the drastic nature of the filters, you should use this middleware for prod
|
|
|
94
94
|
|
|
95
95
|
### Request
|
|
96
96
|
|
|
97
|
-
By default, filters are applied to all request paths. You can norrow this to only certain request paths:
|
|
97
|
+
By default, filters are applied to all request paths. You can norrow this to only certain matching request paths:
|
|
98
98
|
|
|
99
99
|
```ruby
|
|
100
100
|
use Rack::Dedos,
|
|
101
|
-
only_paths: [%r(^/search), %r(
|
|
101
|
+
only_paths: [%r(^/search), %r(\.xml$)]
|
|
102
102
|
|
|
103
103
|
use Rack::Dedos,
|
|
104
104
|
except_paths: [%r(^/$)]
|
|
@@ -30,7 +30,7 @@ module Rack
|
|
|
30
30
|
if !apply?(request) || allowed?(request, ip)
|
|
31
31
|
app.call(env)
|
|
32
32
|
else
|
|
33
|
-
message = "rack-dedos: request #{request.path} from #{ip} blocked by #{
|
|
33
|
+
message = "rack-dedos: request #{request.path} from #{ip} blocked by #{name}"
|
|
34
34
|
warn([message, details].compact.join(": "))
|
|
35
35
|
[options[:status], { 'Content-Type' => 'text/plain' }, [options[:text]]]
|
|
36
36
|
end
|
|
@@ -7,6 +7,10 @@ module Rack
|
|
|
7
7
|
module Filters
|
|
8
8
|
class Country < Base
|
|
9
9
|
|
|
10
|
+
def name
|
|
11
|
+
:country
|
|
12
|
+
end
|
|
13
|
+
|
|
10
14
|
# @option options [String] :maxmind_db_file MaxMind database file
|
|
11
15
|
# @option options [Symbol, Array<Symbol>] :allowed_countries ISO 3166-1 alpha 2
|
|
12
16
|
# @option options [Symbol, Array<Symbol>] :denied_countries ISO 3166-1 alpha 2
|
|
@@ -5,6 +5,10 @@ module Rack
|
|
|
5
5
|
module Filters
|
|
6
6
|
class UserAgent < Base
|
|
7
7
|
|
|
8
|
+
def name
|
|
9
|
+
:user_agent
|
|
10
|
+
end
|
|
11
|
+
|
|
8
12
|
# @option options [String] :cache_url URL of the cache backend
|
|
9
13
|
# @option options [Integer] :cache_period how long to retain cached IP
|
|
10
14
|
# addresses in seconds (default: 900)
|
data/lib/rack/dedos/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rack-dedos
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sven Schwyn
|
|
@@ -85,16 +85,16 @@ dependencies:
|
|
|
85
85
|
requirements:
|
|
86
86
|
- - ">="
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
|
-
version:
|
|
88
|
+
version: 6.0.0
|
|
89
89
|
type: :development
|
|
90
90
|
prerelease: false
|
|
91
91
|
version_requirements: !ruby/object:Gem::Requirement
|
|
92
92
|
requirements:
|
|
93
93
|
- - ">="
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
|
-
version:
|
|
95
|
+
version: 6.0.0
|
|
96
96
|
- !ruby/object:Gem::Dependency
|
|
97
|
-
name: minitest-
|
|
97
|
+
name: minitest-mock
|
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|
|
99
99
|
requirements:
|
|
100
100
|
- - ">="
|
|
@@ -108,7 +108,7 @@ dependencies:
|
|
|
108
108
|
- !ruby/object:Gem::Version
|
|
109
109
|
version: '0'
|
|
110
110
|
- !ruby/object:Gem::Dependency
|
|
111
|
-
name: minitest-
|
|
111
|
+
name: minitest-flash
|
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
|
113
113
|
requirements:
|
|
114
114
|
- - ">="
|
|
@@ -223,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
223
223
|
- !ruby/object:Gem::Version
|
|
224
224
|
version: '0'
|
|
225
225
|
requirements: []
|
|
226
|
-
rubygems_version:
|
|
226
|
+
rubygems_version: 4.0.3
|
|
227
227
|
specification_version: 4
|
|
228
228
|
summary: Radical filters to block denial-of-service (DoS) requests.
|
|
229
229
|
test_files: []
|