wafris 0.5.3 → 0.5.4

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: e59525f95ab8d7eb6699b54e29cf5898ccd705a801f2114d19c120ec7764655e
4
- data.tar.gz: 6c9690caf94f9c521b4bffcaecae3fa15042fc3873f2460f25e02ad68b43f1c4
3
+ metadata.gz: 16f5664939e2ff16c9741e4da47113d28535869a2f143d21fceca33caec7dbb7
4
+ data.tar.gz: 54bc209bf0c7ee9d225d5623681a0d391599a51f2113343f5f9c5f3b57e044bd
5
5
  SHA512:
6
- metadata.gz: 31a0bd63d3dcdda330336cd07367ae29c58a864beeecefe6d893eb18dad9335d84c17c3f1391d509c376f4374d7491cdb9d7616edf4b2b10dee8b34c443ee037
7
- data.tar.gz: 61e9d0164f1082ff2d3da4181c6ccf912b1223499f96cc6011ffce4d12c7328d4f275b81e64fa5967d0dc85a9a4b926fcb609a3ea089006f3d830ac5e308f470
6
+ metadata.gz: e08b0d51693d3489cb5a225a50cb7241ab5f81571ef32f14c4c91cfabef861ed9fba3766477aac3d2baea81d46536c655b99d19715fb4cd496f608df43b15d85
7
+ data.tar.gz: d024cbdfc8923d23b0ebe81080a0238f6741f971b0f7488db376291b5cbe3d585bda06ab7a6ad3547224a95c80e2e182434c28c1c483ed47c70300f16b226289
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Wafris
4
- VERSION = "0.5.3"
4
+ VERSION = "0.5.4"
5
5
  end
data/lib/wafris.rb CHANGED
@@ -32,6 +32,9 @@ module Wafris
32
32
  def allow_request?(request)
33
33
  configuration.connection_pool.with do |conn|
34
34
  time = Time.now.to_f * 1000
35
+ puts "WAF LOG: headers with http-x-forwarded-for key #{request.get_header(Rack::Request::HTTP_X_FORWARDED_FOR)}"
36
+ puts "WAF LOG: Client IP #{client_ip(request)}"
37
+ puts "WAF LOG: Proxy IP #{proxy_ip(request)}"
35
38
  status = conn.evalsha(
36
39
  configuration.core_sha,
37
40
  argv: [
@@ -56,13 +59,13 @@ module Wafris
56
59
  private
57
60
 
58
61
  def client_ip(request)
59
- return request.ip if request.get_header(Rack::Request::HTTP_X_FORWARDED_FOR).nil?
62
+ return request.ip if request.get_header(Rack::Request::HTTP_X_FORWARDED_FOR).eql?(request.ip)
60
63
 
61
64
  request.get_header(Rack::Request::HTTP_X_FORWARDED_FOR).split(',').first
62
65
  end
63
66
 
64
67
  def proxy_ip(request)
65
- return nil if request.get_header(Rack::Request::HTTP_X_FORWARDED_FOR).nil?
68
+ return nil if request.get_header(Rack::Request::HTTP_X_FORWARDED_FOR).eql?(request.ip)
66
69
 
67
70
  request.get_header(Rack::Request::HTTP_X_FORWARDED_FOR).split(',').last
68
71
  end
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: 0.5.3
4
+ version: 0.5.4
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-05-26 00:00:00.000000000 Z
12
+ date: 2023-06-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: connection_pool