wafris 0.3.1 → 0.3.3

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: 385a05bd3deaf1dc68fb7903efa873163c6c79deb6bd6e6411e4fa4985e94dc5
4
- data.tar.gz: a27af04abc69ff0f06ba1145ae811b46fa9ea977b1d4811609f401e4777a3caa
3
+ metadata.gz: 80abfe449ed18fee7441e865dea58c9d178bddb9505ce26ed41a5787bf961089
4
+ data.tar.gz: 36d0516c7299239eadac52f082f948868f4a446b36eae802f68bdd125d25afbd
5
5
  SHA512:
6
- metadata.gz: 0fcbf5d4efab9151175102f9872216e2ae6c7d210e666d2244d662fbe5cfd659cb74bf0357ccb3940c662d9d5659079eddf9b5438640ebb54b932841fdbec7a6
7
- data.tar.gz: a299eb94aad34f481125c4aa33602d0196d0fcaca9acc682c181d59d144a982253d39207fb00c9bdf09879f30eebd0c5328026dc06bfde88d9da1fef7ff43463
6
+ metadata.gz: 7aa631485765eed274640da682706d1229a0f49645663ed403a975b5267f40c3f43fc7d99477b6101a12d1b6acacc38a067ad5bba0f6047d01e4385fb86eb9a5
7
+ data.tar.gz: 0dac3dbf69a72ba9597e2056a929179e0301fba06ab7503e4620abfd25953265202762fa83507c65aa597cef36cefe468bcaf939c1d1f10ba4ebc04a5ec09d0c
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Wafris
4
- VERSION = "0.3.1"
4
+ VERSION = "0.3.3"
5
5
  end
data/lib/wafris.rb CHANGED
@@ -32,8 +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 x-forwarded-for key #{request.get_header('x-forwarded-for')}"
36
- puts "WAF LOG: headers with http-x-forwarded-for key #{request.get_header('HTTP_X_FORWARDED_FOR')}"
35
+ puts "WAF LOG: headers with http-x-forwarded-for key #{request.get_header(Rack::Request::HTTP_X_FORWARDED_FOR)}"
37
36
  puts "WAF LOG: Client IP #{client_ip(request)}"
38
37
  puts "WAF LOG: Proxy IP #{proxy_ip(request)}"
39
38
  status = conn.evalsha(
@@ -60,15 +59,15 @@ module Wafris
60
59
  private
61
60
 
62
61
  def client_ip(request)
63
- return request.ip if request.get_header('x-forwarded-for').nil?
62
+ return request.ip if request.get_header(Rack::Request::HTTP_X_FORWARDED_FOR).nil?
64
63
 
65
- request.headers['x-forwarded-for'].split(',').first
64
+ request.get_header[Rack::Request::HTTP_X_FORWARDED_FOR].split(',').first
66
65
  end
67
66
 
68
67
  def proxy_ip(request)
69
- return nil if request.get_header('x-forwarded-for').nil?
68
+ return nil if request.get_header(Rack::Request::HTTP_X_FORWARDED_FOR).nil?
70
69
 
71
- request.headers['x-forwarded-for'].split(',').last
70
+ request.get_header[Rack::Request::HTTP_X_FORWARDED_FOR].split(',').last
72
71
  end
73
72
  end
74
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.1
4
+ version: 0.3.3
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