sensu 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 033a973109e8bcb6bb775163452c270b74907afe
4
- data.tar.gz: 464a435d9c1191d9e8b941681c8b53af57977940
3
+ metadata.gz: ffda8bc29ab44f27d429a83caca7dc70c779c474
4
+ data.tar.gz: 1be8182e6b77bc9ad9be630e74f5b3511d5a60f1
5
5
  SHA512:
6
- metadata.gz: be59c0a1d75341cfec86f91e29f978c8c5a5a629cad565918d253f687e72958c18a037f4919d04746802da3ddab4a7664388c6538f2eaf24a4fa01b9795f2d5d
7
- data.tar.gz: 4775c24d752d40cc2ae90795a80ff81095796a4aabd0d5d9b719e58d45c80ac74b6f9234f6e3d321c41c7505941f7ec8424573e0845d5dd06618ab8ab54b9632
6
+ metadata.gz: 576a015911e86dce7699586be7904777590a47e9a6ec88f20116b569f6ce685931e426084bd15e57225a271dc9d767882968c61f3377484d49debed48e95ac2a
7
+ data.tar.gz: 9c8fcb61b2405cc8aae22ec16fe61836830c521700f9d017b21da15e705d548a4feab3273afe933f2b236194db92dc7606d5e4de83d7c3dac3f69b139050cd3d
@@ -1,3 +1,10 @@
1
+ ## 1.2.1 - 2018-02-06
2
+
3
+ ### Fixes
4
+
5
+ Fixed a bug in which sensitive values deeply nested in arrays would
6
+ not have been redacted.
7
+
1
8
  ## 1.2.0 - 2017-12-05
2
9
 
3
10
  ### Features
@@ -14,7 +21,7 @@ a request ID, the API generates one for the request (UUID).
14
21
  The Sensu API `/results/*` endpoints now include check history in the
15
22
  result data.
16
23
 
17
- Check token substitution is now supported in check "subdue".
24
+ Check token substitution is now supported in check "source".
18
25
 
19
26
  ## 1.1.3 - 2017-11-24
20
27
 
@@ -1,7 +1,7 @@
1
1
  module Sensu
2
2
  unless defined?(Sensu::VERSION)
3
3
  # Sensu release version.
4
- VERSION = "1.2.0".freeze
4
+ VERSION = "1.2.1".freeze
5
5
 
6
6
  # Sensu release information.
7
7
  RELEASE_INFO = {
@@ -94,29 +94,35 @@ module Sensu
94
94
  # password, passwd, pass, api_key, api_token, access_key,
95
95
  # secret_key, private_key, secret
96
96
  #
97
- # @param hash [Hash] to redact sensitive value from.
97
+ # @param obj [Object] to redact sensitive value from.
98
98
  # @param keys [Array] that indicate sensitive values.
99
99
  # @return [Hash] hash with redacted sensitive values.
100
- def redact_sensitive(hash, keys=nil)
100
+ def redact_sensitive(obj, keys=nil)
101
101
  keys ||= %w[
102
102
  password passwd pass
103
103
  api_key api_token
104
104
  access_key secret_key private_key
105
105
  secret
106
106
  ]
107
- hash = hash.dup
108
- hash.each do |key, value|
109
- if keys.include?(key.to_s)
110
- hash[key] = "REDACTED"
111
- elsif value.is_a?(Hash)
112
- hash[key] = redact_sensitive(value, keys)
113
- elsif value.is_a?(Array)
114
- hash[key] = value.map do |item|
115
- item.is_a?(Hash) ? redact_sensitive(item, keys) : item
107
+ obj = obj.dup
108
+ if obj.is_a?(Hash)
109
+ obj.each do |key, value|
110
+ if keys.include?(key.to_s)
111
+ obj[key] = "REDACTED"
112
+ elsif value.is_a?(Hash) || value.is_a?(Array)
113
+ obj[key] = redact_sensitive(value, keys)
114
+ end
115
+ end
116
+ elsif obj.is_a?(Array)
117
+ obj.map! do |item|
118
+ if item.is_a?(Hash) || item.is_a?(Array)
119
+ redact_sensitive(item, keys)
120
+ else
121
+ item
116
122
  end
117
123
  end
118
124
  end
119
- hash
125
+ obj
120
126
  end
121
127
 
122
128
  # Traverse a hash for an attribute value, with a fallback default
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Porter
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-12-05 00:00:00.000000000 Z
12
+ date: 2018-02-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine