instana 1.199.0 → 1.199.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/instana/secrets.rb +18 -8
- data/lib/instana/version.rb +1 -1
- data/test/secrets_test.rb +13 -3
- 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: 5bfc77f8ea09bd4e8c493e97261b962a4b4f6227de513806b7b41beacea46118
|
4
|
+
data.tar.gz: 3ab9bc87d33895f4df52ba02bb9f9dfd14364547fb9ebe4b4ef47ab1a2ef1aa0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cfcd49b02a42fd0160c50584cd62c2b98664f7d416dc7935a53d72e092d96dfeead989fc58ab66f95acdde4ef48acdf7179e4dbcbe4a58906c41d6380ec700e
|
7
|
+
data.tar.gz: 7d6265faff1cad2ae597f66397d192d9ed1dbbe5634d1c3aeeb1d05ac2a8548061a8023990b296bb9a23934b1d0fc396ff267eb282a265415c56e1d986dbd9af
|
data/lib/instana/secrets.rb
CHANGED
@@ -13,21 +13,31 @@ module Instana
|
|
13
13
|
def remove_from_query(str, secret_values = Instana.agent.secret_values)
|
14
14
|
return str unless secret_values
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
begin
|
17
|
+
url = URI(str)
|
18
|
+
params = url.scheme ? CGI.parse(url.query || '') : CGI.parse(url.to_s)
|
19
|
+
|
20
|
+
redacted = redact(params, secret_values)
|
21
|
+
|
22
|
+
url.query = URI.encode_www_form(redacted)
|
23
|
+
url.scheme ? CGI.unescape(url.to_s) : CGI.unescape(url.query)
|
24
|
+
rescue URI::InvalidURIError => _e
|
25
|
+
params = CGI.parse(str || '')
|
26
|
+
redacted = redact(params, secret_values)
|
27
|
+
CGI.unescape(URI.encode_www_form(redacted))
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
18
32
|
|
19
|
-
|
33
|
+
def redact(params, secret_values)
|
34
|
+
params.map do |k, v|
|
20
35
|
needs_redaction = secret_values['list']
|
21
36
|
.any? { |t| matcher(secret_values['matcher']).(t,k) }
|
22
37
|
[k, needs_redaction ? '<redacted>' : v]
|
23
38
|
end
|
24
|
-
|
25
|
-
url.query = URI.encode_www_form(redacted)
|
26
|
-
url.scheme ? CGI.unescape(url.to_s) : CGI.unescape(url.query)
|
27
39
|
end
|
28
40
|
|
29
|
-
private
|
30
|
-
|
31
41
|
def matcher(name)
|
32
42
|
case name
|
33
43
|
when 'equals-ignore-case'
|
data/lib/instana/version.rb
CHANGED
data/test/secrets_test.rb
CHANGED
@@ -78,6 +78,16 @@ class SecretsTest < Minitest::Test
|
|
78
78
|
assert_redacted @subject.remove_from_query(url, sample_config), %w(instantiate)
|
79
79
|
end
|
80
80
|
|
81
|
+
def test_without_url
|
82
|
+
sample_config = {
|
83
|
+
"matcher"=>"contains",
|
84
|
+
"list"=>["stan"]
|
85
|
+
}
|
86
|
+
|
87
|
+
url = 'filter[instantiate]=true'
|
88
|
+
assert_redacted @subject.remove_from_query(url, sample_config), %w(filter[instantiate]), raw_str: true
|
89
|
+
end
|
90
|
+
|
81
91
|
private
|
82
92
|
|
83
93
|
def url_for(keys)
|
@@ -86,9 +96,9 @@ class SecretsTest < Minitest::Test
|
|
86
96
|
url.to_s
|
87
97
|
end
|
88
98
|
|
89
|
-
def assert_redacted(str, keys)
|
90
|
-
|
91
|
-
params
|
99
|
+
def assert_redacted(str, keys, raw_str: false)
|
100
|
+
params = raw_str ? CGI.parse(str) : CGI.parse(URI(str).query)
|
101
|
+
pp params
|
92
102
|
|
93
103
|
assert_equal keys, params.select { |_, v| v == %w(<redacted>) }.keys, 'to be redacted'
|
94
104
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instana
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.199.
|
4
|
+
version: 1.199.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Giacomo Lombardo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|