startback 1.2.2 → 1.2.3
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/startback/support/redactor.rb +3 -2
- data/lib/startback/version.rb +1 -1
- data/spec/unit/support/test_redactor.rb +13 -0
- 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: 7807796286047fe2edb12603e7bf130a48aaedce349a154e8124c09012d3f171
|
|
4
|
+
data.tar.gz: c2a5a0e7cba2a2ed6b59343654c1e3404ff2a2c09c740e657b843f290aff4ac3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d32e019f5d4492bfa5b10b1addc6b662ac85eb0744171d803bb3a5cd1e36a4811106dfae8be0488a146ec832f2d6d5ad574bc1a2a1d0e646c96545ac15ed3ce3
|
|
7
|
+
data.tar.gz: 07ce0ad6fa20798f48c760c49b49640d2d52b961e08bacb0d536461ee43a8d3a1166309df9aa00c9c6af359c8dc0ff68e615c8cc4218c0b08e0a7633822ed5f1
|
|
@@ -21,8 +21,9 @@ module Startback
|
|
|
21
21
|
}]
|
|
22
22
|
when Enumerable
|
|
23
23
|
data.map{|elm| redact(elm) }.compact
|
|
24
|
-
when
|
|
25
|
-
data
|
|
24
|
+
when String
|
|
25
|
+
return data unless data.valid_encoding?
|
|
26
|
+
data =~ /:\/\// ? data.gsub(/:\/\/([^@]+[@])/){|m| "://--redacted--@" } : data
|
|
26
27
|
else
|
|
27
28
|
data
|
|
28
29
|
end
|
data/lib/startback/version.rb
CHANGED
|
@@ -90,6 +90,19 @@ module Startback
|
|
|
90
90
|
expect(r.redact('http://user:password@google.com/a/path')).to eql('http://--redacted--@google.com/a/path')
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
+
it 'handles strings with invalid encoding without raising' do
|
|
94
|
+
binary = "hello\x80\xFF world".dup.force_encoding('UTF-8')
|
|
95
|
+
expect(binary.valid_encoding?).to be false
|
|
96
|
+
expect { redactor.redact(binary) }.not_to raise_error
|
|
97
|
+
expect(redactor.redact(binary)).to equal(binary)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
it 'handles binary strings in nested structures' do
|
|
101
|
+
binary = "\x80\xFF".dup.force_encoding('UTF-8')
|
|
102
|
+
data = { foo: "bar", nested: { value: binary } }
|
|
103
|
+
expect { redactor.redact(data) }.not_to raise_error
|
|
104
|
+
end
|
|
105
|
+
|
|
93
106
|
end # class Redactor
|
|
94
107
|
end # module Support
|
|
95
108
|
end # module Startback
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: startback
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bernard Lambeau
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-03-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|