wafris 0.3.0 → 0.3.2

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: 2da3a1b92fba96e01f65433a9388d7dbeb8f24225b352e1958f392cd82fc8522
4
- data.tar.gz: c8a72dcb1459454890d11d5ba0190f2b4a7f0d13cc63ce9d7038e87cb8ca7af7
3
+ metadata.gz: f40d28c339b6167ef558a03145a20477a55779246ac7d52bcd058e7baa63fb2a
4
+ data.tar.gz: 5043bc5116442c5889baaa059f55b949f66e028c263ae03e61d4484a02d722e7
5
5
  SHA512:
6
- metadata.gz: ef4e1b43b6ae8f9060e8ba936ebffed084288e3a0df798c487141dd608f9f136e4cde74babc9ed9ab9c908f96a558fd674dcc9b579f94cc0bc95da581a973a20
7
- data.tar.gz: a252ddc02c510c14c011c23d3127a5f17d7dc97dc6b44a46e889b85b4130e9897c4d9623fb6ad144e6cc32f21524ad5d58f008d9d1b6376c47884c2f42c94008
6
+ metadata.gz: 578e7d857281b21993cc02b80c870df50500942b44530a1ce1506e423d3f0a00229841af9e127e7ab2984c1f523b526c3dc77ab6db45215429bb9362ab568b0b
7
+ data.tar.gz: ff68250d17e420f1601928950a9a91c24f5029ab739ff2f668818d1db4cfb56e9f4d400c3901b9a9a7437848e055b929d5170ad12486a02f4bfa58cd1620366b
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Wafris
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.2"
5
5
  end
data/lib/wafris.rb CHANGED
@@ -32,6 +32,7 @@ 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)}"
35
36
  puts "WAF LOG: Client IP #{client_ip(request)}"
36
37
  puts "WAF LOG: Proxy IP #{proxy_ip(request)}"
37
38
  status = conn.evalsha(
@@ -58,15 +59,15 @@ module Wafris
58
59
  private
59
60
 
60
61
  def client_ip(request)
61
- return request.ip if request.headers['x-forwarded-for'].nil?
62
+ return request.ip if request.get_header(Rack::Request::HTTP_X_FORWARDED_FOR).nil?
62
63
 
63
- request.headers['x-forwarded-for'].split(',').first
64
+ request.headers[Rack::Request::HTTP_X_FORWARDED_FOR].split(',').first
64
65
  end
65
66
 
66
67
  def proxy_ip(request)
67
- return nil if request.headers['x-forwarded-for'].nil?
68
+ return nil if request.get_header(Rack::Request::HTTP_X_FORWARDED_FOR).nil?
68
69
 
69
- request.headers['x-forwarded-for'].split(',').last
70
+ request.headers[Rack::Request::HTTP_X_FORWARDED_FOR].split(',').last
70
71
  end
71
72
  end
72
73
  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.3.0
4
+ version: 0.3.2
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-22 00:00:00.000000000 Z
12
+ date: 2023-05-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: connection_pool