redacting-logger 1.3.2 → 1.4.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/redacting_logger.rb +13 -17
- data/lib/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb980a659ce06020cf43322b1652e7f36f53793f387e97049b3e4922faca772b
|
4
|
+
data.tar.gz: 73101d1dcc3f9314c7d4ff256333e9b2a6b2ef6732a7c3b8c88f66b73f5e62cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a134230a43184f9c23b398c31ec8d96ae71c42bd9dec4c8c39dfd648d0ff66f22b8455d957c21a78c6e2e3c816b6b0bab6e71fe66f76c3016acb5b6f16fbbed5
|
7
|
+
data.tar.gz: 69b4547b49dd8fae9ed05aa6ac384fd7ea6c9994fd988620fe5a6cecf46db55dce2a164e3fa4b51e7c25991edf8bd2121f825fbea4f174d1b3ba2880091526fe
|
data/lib/redacting_logger.rb
CHANGED
@@ -30,6 +30,8 @@ class RedactingLogger < Logger
|
|
30
30
|
@redact_patterns = redact_patterns
|
31
31
|
@redacted_msg = redacted_msg
|
32
32
|
@redact_patterns += Patterns::DEFAULT if use_default_patterns
|
33
|
+
|
34
|
+
@redact_patterns = Regexp.union(@redact_patterns)
|
33
35
|
end
|
34
36
|
|
35
37
|
# Adds a message to the log.
|
@@ -40,30 +42,24 @@ class RedactingLogger < Logger
|
|
40
42
|
def add(severity, message = nil, progname = nil)
|
41
43
|
message, progname = yield if block_given?
|
42
44
|
|
43
|
-
|
44
|
-
case message
|
45
|
-
|
46
|
-
when String, Symbol, Numeric
|
47
|
-
message = message.to_s.gsub(pattern, @redacted_msg)
|
45
|
+
case message
|
48
46
|
|
49
|
-
|
50
|
-
|
51
|
-
m.to_s.gsub(pattern, @redacted_msg)
|
52
|
-
end
|
47
|
+
when String, Symbol, Numeric
|
48
|
+
message = message.to_s.gsub(@redact_patterns, @redacted_msg)
|
53
49
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
50
|
+
when Array
|
51
|
+
message = message.map do |m|
|
52
|
+
m.to_s.gsub(@redact_patterns, @redacted_msg)
|
58
53
|
end
|
59
|
-
end
|
60
54
|
|
61
|
-
|
62
|
-
|
63
|
-
|
55
|
+
when Hash
|
56
|
+
message = message.transform_values do |v|
|
57
|
+
v.to_s.gsub(@redact_patterns, @redacted_msg)
|
64
58
|
end
|
65
59
|
end
|
66
60
|
|
61
|
+
progname = progname.to_s.gsub(@redact_patterns, @redacted_msg) if progname
|
62
|
+
|
67
63
|
super
|
68
64
|
end
|
69
65
|
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redacting-logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub
|
8
8
|
- GitHub Security
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2025-03-18 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: logger
|
@@ -46,7 +45,6 @@ metadata:
|
|
46
45
|
source_code_uri: https://github.com/github/redacting-logger
|
47
46
|
documentation_uri: https://github.com/github/redacting-logger
|
48
47
|
bug_tracker_uri: https://github.com/github/redacting-logger/issues
|
49
|
-
post_install_message:
|
50
48
|
rdoc_options: []
|
51
49
|
require_paths:
|
52
50
|
- lib
|
@@ -61,8 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
59
|
- !ruby/object:Gem::Version
|
62
60
|
version: '0'
|
63
61
|
requirements: []
|
64
|
-
rubygems_version: 3.
|
65
|
-
signing_key:
|
62
|
+
rubygems_version: 3.6.2
|
66
63
|
specification_version: 4
|
67
64
|
summary: A redacting Ruby logger to prevent the leaking of secrets via logs
|
68
65
|
test_files: []
|