bizside 2.3.8 → 2.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bizside/audit_log.rb +24 -3
- data/lib/bizside/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46b9cdead64c8e2f35b91ed65a21ec4e78331522211421a6e75015a75124bcc1
|
4
|
+
data.tar.gz: e2fc1dd98565f9e20e362b229035f6b5a9b38a2e6c1abad95eb0c58e55493c77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87fc2260a1eaafd7af65e708a6574a3f28fada1673103ba1ab9c0a70f70168eaeacb56bea82be997d92580dc9d2ec4e94327d838625aacf3dcfe89e24d5e8364
|
7
|
+
data.tar.gz: fb05cc1b9a8db6ffc9aa42a676a25424d9625aa1b9156c22197f4af52e0314a280775301b83fb3ef922e79956bc5d23fae0b30bee713d6c67632e6b50de1c7f8
|
data/lib/bizside/audit_log.rb
CHANGED
@@ -1,15 +1,23 @@
|
|
1
|
+
require 'ipaddr'
|
1
2
|
require_relative 'audit/logger'
|
2
3
|
|
3
4
|
module Bizside
|
4
5
|
class AuditLog
|
5
6
|
|
6
7
|
@@ignore_paths = []
|
8
|
+
@@trusted_proxy_cidrs = []
|
9
|
+
@@trusted_proxy_cidr_objects = {}
|
7
10
|
@@truncate_length = 8192
|
8
11
|
|
9
12
|
def self.ignore_paths
|
10
13
|
@@ignore_paths
|
11
14
|
end
|
12
15
|
|
16
|
+
# 192.168.0.0/24 といったCIDR表記の文字列を複数指定可能
|
17
|
+
def self.trusted_proxy_cidrs
|
18
|
+
@@trusted_proxy_cidrs
|
19
|
+
end
|
20
|
+
|
13
21
|
def self.truncate_length
|
14
22
|
@@truncate_length
|
15
23
|
end
|
@@ -25,7 +33,7 @@ module Bizside
|
|
25
33
|
def call(env)
|
26
34
|
start = Time.now.strftime('%Y-%m-%dT%H:%M:%S.%3N%z')
|
27
35
|
status, headers, response = @app.call(env)
|
28
|
-
stop = Time.now.strftime('%Y-%m-%dT%H:%M:%S.%3N%z')
|
36
|
+
stop = Time.now.strftime('%Y-%m-%dT%H:%M:%S.%3N%z')
|
29
37
|
exception = env[Bizside::ShowExceptions::BIZSIDE_EXCEPTION_ENV_KEY]
|
30
38
|
|
31
39
|
if env['BIZSIDE_SUPPRESS_AUDIT']
|
@@ -180,10 +188,23 @@ module Bizside
|
|
180
188
|
exception.backtrace.join("\n")[0...truncate_length]
|
181
189
|
end
|
182
190
|
|
183
|
-
# 信頼のおけるロードバランサーがプロキシーになっている前提で、各HTTP
|
191
|
+
# 信頼のおけるロードバランサーがプロキシーになっている前提で、各HTTPヘッダの最後のIPをクライアントIPとして取得する
|
184
192
|
def to_client_ip(header_value)
|
185
193
|
ips = header_value ? header_value.strip.split(/[,\s]+/) : []
|
186
|
-
ips.
|
194
|
+
ips.reverse.each do |ip|
|
195
|
+
return ip unless proxy?(ip)
|
196
|
+
end
|
197
|
+
|
198
|
+
nil
|
199
|
+
end
|
200
|
+
|
201
|
+
def proxy?(ip)
|
202
|
+
@@trusted_proxy_cidrs.each do |cidr|
|
203
|
+
cidr_obj = @@trusted_proxy_cidr_objects[cidr] ||= IPAddr.new(cidr)
|
204
|
+
return true if cidr_obj.include?(ip)
|
205
|
+
end
|
206
|
+
|
207
|
+
false
|
187
208
|
end
|
188
209
|
|
189
210
|
end
|
data/lib/bizside/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bizside
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bizside-developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -368,7 +368,7 @@ dependencies:
|
|
368
368
|
version: 1.5.0
|
369
369
|
description: Bizside is an utilities to assist building web application.
|
370
370
|
email:
|
371
|
-
- bizside-developers@
|
371
|
+
- bizside-developers@bizside.biz
|
372
372
|
executables: []
|
373
373
|
extensions: []
|
374
374
|
extra_rdoc_files: []
|
@@ -475,7 +475,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
475
475
|
- !ruby/object:Gem::Version
|
476
476
|
version: '0'
|
477
477
|
requirements: []
|
478
|
-
rubygems_version: 3.
|
478
|
+
rubygems_version: 3.3.26
|
479
479
|
signing_key:
|
480
480
|
specification_version: 4
|
481
481
|
summary: Bizside is an utilities for web application.
|