wafris 1.1.5 → 1.1.7

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: 41a7301f46edd2db86921b04d380bae6be50bf420a7dce0d2253bfc9c357cbe3
4
- data.tar.gz: 65210ab5daf81400a59e28423420aad4bc727f47f6cf71ff76111435fe685caa
3
+ metadata.gz: 5214c54be014012a7e6c155f70530c5771834ae6fb471f50a55982bc8f7d2217
4
+ data.tar.gz: 5fd19e2a7431f05ea5cd1c0142643ab9bf5afee0c8c944d19cab2849158483e1
5
5
  SHA512:
6
- metadata.gz: 73b821f4b6f72ca1a54ff457660fcdd4ca40c02a129df69bfb3ada73d189c0ece8b5bd147a937a1abd3347a8eea540c9674e5b36efa54857346128d44622a46e
7
- data.tar.gz: cb866469bfe08d891202c77758a8408541f993ed784f405609340f0b02313ab2221c4b2166fc1f984194dc21bf4f631e4272c55322ee87eeb7d33998e580be32
6
+ metadata.gz: 5b19c182029512007f2428b6cf0662cb4772306aff63f8fb9bf13f7b7210d651cad796895095dca60f6ac4cdfa22bdf0b444f2389c867a35f712d4c02417b6e2
7
+ data.tar.gz: 91f7afb62403e7ef3edc8260a5e50110af9da3ccdcdf0903cce39d5b22138649fda0a6d464665e1615e148cbd726906e269c942a5670516e1e61ed74e1bcabe0
@@ -7,10 +7,12 @@ module Wafris
7
7
  attr_accessor :redis
8
8
  attr_accessor :redis_pool_size
9
9
  attr_accessor :maxmemory
10
+ attr_accessor :quiet_mode
10
11
 
11
12
  def initialize
12
13
  @redis_pool_size = 20
13
14
  @maxmemory = 25
15
+ @quiet_mode = false
14
16
  end
15
17
 
16
18
  def connection_pool
@@ -24,8 +26,8 @@ module Wafris
24
26
  'client', 'ruby',
25
27
  'maxmemory', @maxmemory)
26
28
  LogSuppressor.puts_log(
27
- "[Wafris] firewall enabled. Connected to Redis. Ready to process requests. Set rules at: https://wafris.org/hub"
28
- )
29
+ "[Wafris] firewall enabled. Connected to Redis on #{redis.connection[:host]}. Ready to process requests. Set rules at: https://wafris.org/hub"
30
+ ) unless @quiet_mode
29
31
  end
30
32
 
31
33
  def core_sha
@@ -29,9 +29,16 @@ module Wafris
29
29
  if Wafris.allow_request?(request)
30
30
  @app.call(env)
31
31
  else
32
- puts 'blocked'
32
+ LogSuppressor.puts_log(
33
+ "[Wafris] Blocked: #{request.ip} #{request.request_method} #{request.host} #{request.url}}"
34
+ )
33
35
  [403, {}, ['Blocked']]
34
36
  end
37
+ rescue Redis::TimeoutError
38
+ LogSuppressor.puts_log(
39
+ "[Wafris] Wafris timed out during processing. Request passed without rules check."
40
+ )
41
+ @app.call(env)
35
42
  rescue StandardError => e
36
43
  LogSuppressor.puts_log(
37
44
  "[Wafris] Redis connection error: #{e.message}. Request passed without rules check."
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Wafris
4
- VERSION = "1.1.5"
4
+ VERSION = "1.1.7"
5
5
  end
data/lib/wafris.rb CHANGED
@@ -21,7 +21,7 @@ module Wafris
21
21
  yield(configuration)
22
22
  LogSuppressor.puts_log(
23
23
  "[Wafris] attempting firewall connection via Wafris.configure initializer."
24
- )
24
+ ) unless configuration.quiet_mode
25
25
  configuration.create_settings
26
26
  rescue Redis::CannotConnectError, ArgumentError
27
27
  LogSuppressor.puts_log(
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wafris
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micahel Buckbee
@@ -9,40 +9,34 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-09-22 00:00:00.000000000 Z
12
+ date: 2023-11-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: connection_pool
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
19
- - !ruby/object:Gem::Version
20
- version: '2.3'
21
18
  - - ">="
22
19
  - !ruby/object:Gem::Version
23
- version: 2.3.0
20
+ version: '2.3'
24
21
  type: :runtime
25
22
  prerelease: false
26
23
  version_requirements: !ruby/object:Gem::Requirement
27
24
  requirements:
28
- - - "~>"
29
- - !ruby/object:Gem::Version
30
- version: '2.3'
31
25
  - - ">="
32
26
  - !ruby/object:Gem::Version
33
- version: 2.3.0
27
+ version: '2.3'
34
28
  - !ruby/object:Gem::Dependency
35
29
  name: rack
36
30
  requirement: !ruby/object:Gem::Requirement
37
31
  requirements:
38
- - - "~>"
32
+ - - ">="
39
33
  - !ruby/object:Gem::Version
40
34
  version: '2.0'
41
35
  type: :runtime
42
36
  prerelease: false
43
37
  version_requirements: !ruby/object:Gem::Requirement
44
38
  requirements:
45
- - - "~>"
39
+ - - ">="
46
40
  - !ruby/object:Gem::Version
47
41
  version: '2.0'
48
42
  - !ruby/object:Gem::Dependency