chihiro 0.3.0 → 0.3.1
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 +4 -4
- data/lib/chihiro/loggable.rb +5 -2
- data/lib/chihiro/mask_util.rb +7 -1
- data/lib/chihiro/version.rb +1 -1
- data/pkg/chihiro-0.3.0.gem +0 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfc59219e6e8b0f766857bc56113c0d971a6026b3cdf26ebc50980db456d4eb0
|
4
|
+
data.tar.gz: 2acdfe54c7b817bfb3bdcc923574a2513c1141e0aecdb3022e66c20d6650931f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a837de308e81d9421d681179366ded79038c7b477e544d918ce39d5bebd07b594c4c5f924ffd98354365aafbc220b81e6b6bb090dcb74e191f1ce55d2eab7538
|
7
|
+
data.tar.gz: 41f039b50250db652416cd2c624a10b9dc4e53b7e6e1267957118c3e387704bf093088d9f39e3d7ccae226ddbbe33cd4fc18a9caf40e9f58b8d7367536a003d7
|
data/lib/chihiro/loggable.rb
CHANGED
@@ -20,12 +20,13 @@ module Chihiro
|
|
20
20
|
def log_request
|
21
21
|
to_log = {
|
22
22
|
message: 'Received API request',
|
23
|
-
requestPath: request.path
|
23
|
+
requestPath: request.path,
|
24
|
+
requestMethod: request.request_method
|
24
25
|
}
|
25
26
|
if Rails.configuration.no_log_param_paths.include?("#{controller_name}##{action_name}")
|
26
27
|
Rails.logger.info(to_log)
|
27
28
|
else
|
28
|
-
Rails.logger.info(to_log.merge(params: params.as_json))
|
29
|
+
Rails.logger.info(to_log.merge(params: params.except(:format, :controller, :action).as_json))
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
@@ -33,6 +34,7 @@ module Chihiro
|
|
33
34
|
to_log = {
|
34
35
|
message: 'Send API Response',
|
35
36
|
requestPath: request.path,
|
37
|
+
requestMethod: request.request_method,
|
36
38
|
responseStatus: response.status.to_s
|
37
39
|
}
|
38
40
|
Rails.logger.info(to_log)
|
@@ -42,6 +44,7 @@ module Chihiro
|
|
42
44
|
to_log = {
|
43
45
|
message: 'Catched exception in controller',
|
44
46
|
requestPath: request.path,
|
47
|
+
requestMethod: request.request_method,
|
45
48
|
exceptionClass: e.class.to_s,
|
46
49
|
exceptionMessage: e.message,
|
47
50
|
backtrace: e.backtrace
|
data/lib/chihiro/mask_util.rb
CHANGED
@@ -21,6 +21,10 @@ module Chihiro
|
|
21
21
|
lambda { |value| value.to_s.gsub(/./, '*') }
|
22
22
|
end
|
23
23
|
|
24
|
+
def mask_email
|
25
|
+
lambda { |value| value.to_s.gsub(/(?<=.{3}).(?=[^@]*?@)/, '*') }
|
26
|
+
end
|
27
|
+
|
24
28
|
def masks
|
25
29
|
@all_masks ||= {
|
26
30
|
'password' => mask_all_characters,
|
@@ -28,7 +32,9 @@ module Chihiro
|
|
28
32
|
'token' => mask_all_characters,
|
29
33
|
'otp' => mask_all_characters,
|
30
34
|
'current_password' => mask_all_characters,
|
31
|
-
'new_password' => mask_all_characters
|
35
|
+
'new_password' => mask_all_characters,
|
36
|
+
'email' => mask_email,
|
37
|
+
'user_email' => mask_email
|
32
38
|
}
|
33
39
|
end
|
34
40
|
|
data/lib/chihiro/version.rb
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chihiro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shu Hui
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lograge
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- pkg/chihiro-0.2.0.gem
|
111
111
|
- pkg/chihiro-0.2.1.gem
|
112
112
|
- pkg/chihiro-0.2.2.gem
|
113
|
+
- pkg/chihiro-0.3.0.gem
|
113
114
|
- spec/chihiro_spec.rb
|
114
115
|
- spec/mask_util_spec.rb
|
115
116
|
- spec/spec_helper.rb
|