wafris 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wafris/version.rb +1 -1
- data/lib/wafris.rb +5 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16f5664939e2ff16c9741e4da47113d28535869a2f143d21fceca33caec7dbb7
|
4
|
+
data.tar.gz: 54bc209bf0c7ee9d225d5623681a0d391599a51f2113343f5f9c5f3b57e044bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e08b0d51693d3489cb5a225a50cb7241ab5f81571ef32f14c4c91cfabef861ed9fba3766477aac3d2baea81d46536c655b99d19715fb4cd496f608df43b15d85
|
7
|
+
data.tar.gz: d024cbdfc8923d23b0ebe81080a0238f6741f971b0f7488db376291b5cbe3d585bda06ab7a6ad3547224a95c80e2e182434c28c1c483ed47c70300f16b226289
|
data/lib/wafris/version.rb
CHANGED
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).
|
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).
|
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.
|
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
|
12
|
+
date: 2023-06-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: connection_pool
|