wafris 1.1.6 → 1.1.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26fb7a9c87c4238e2c810f329d05d0b67e15cecfd17a38a4dbb6711a77c872c4
4
- data.tar.gz: eef34887f3191a32c0f5a8631d51355d1ea12822c37a61a40e7d57ac6f8ae5b9
3
+ metadata.gz: 5214c54be014012a7e6c155f70530c5771834ae6fb471f50a55982bc8f7d2217
4
+ data.tar.gz: 5fd19e2a7431f05ea5cd1c0142643ab9bf5afee0c8c944d19cab2849158483e1
5
5
  SHA512:
6
- metadata.gz: f2b038b098e498bce083b14fd4d78e9b9fcdcad85f5078dc8987cb1f6d9b066c911cbeb9091a31c4c12275f6dfdb8754b700585fe7063e4ead1f7625ed1807b1
7
- data.tar.gz: 5268042953c24243581198aedd4d01e53a677c199f78f35dc2a559f6f8ec399b4789a4a1e7a9cd41361c6cc91066468f2192aa52e9cf4c77d34b2e1ee3fc735b
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
@@ -25,7 +27,7 @@ module Wafris
25
27
  'maxmemory', @maxmemory)
26
28
  LogSuppressor.puts_log(
27
29
  "[Wafris] firewall enabled. Connected to Redis on #{redis.connection[:host]}. Ready to process requests. Set rules at: https://wafris.org/hub"
28
- )
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.6"
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.6
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micahel Buckbee
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-10-03 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