vcap_common 3.0.1 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MmZmY2Q4Njk2OGJhZWUyNGVkZDA0MWIwNjNkNzBiNTgwMThhY2ViNg==
4
+ OTQ2YjBjZWRmYTgyZmRmZmI5MWExNDA1MGE1NjZkMTFkNGE4ZDY2MA==
5
5
  data.tar.gz: !binary |-
6
- NWQ2ZTkyZTNmMjE5NDgwYzRhNmExOWJjNjIwNzczYzUxN2E3NWI2OQ==
6
+ MGQzY2E0ODY2YzBjMjMxOTEwOGNlZGM2ZmY0MTJmNTFlNmIzOTE2OA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NWI5MDQyN2QzNjE0ZmQzMTczYmNkMzE1YzFiOGJhZTljZDg4ODVmZTdhZmYx
10
- M2ZhMTg1MTg4NzViNzFjNDEwZDM3YmE4MjIzYmU5ZDAyYTRiOWU3MzNmMmYz
11
- YzA1MjQ5ZjQ2M2JmODYxMmE5MzgwNTQ4M2FjZDc0NDFkZjFlZWM=
9
+ YjU3NDYwZGYxMjNhZmEwODRiZTg3ZTJmZDllZmVkODg3NjJkYTYzYmJmNTYx
10
+ YzhiZGQ5MGRkZTk5OTIxNTA0MGU0ZmY5OTQ2ZWE4Y2Q5NDhjNDVlYWVlMzgx
11
+ YzRjMDY4N2Q4Njg2OGY1MjgyYWE4NzExNWJjNTkwYTc3MzM2NjI=
12
12
  data.tar.gz: !binary |-
13
- MmI2ZjQ4Nzg5MWJlNzZiOTAyNDk2MzAzN2Q3NGRjZGIyNzgxZGM4N2Y2OWNj
14
- ODM3NGJlOTkzNWU4MTUwMmM3NGFkMDkyMjVlZTcxZDllZmQ4ZTliYjI2MzU2
15
- ZmVhYmY1ZDc3NjhmZDk5YzhkYTRiODg4N2NjNTFmZDBhMmI5MGQ=
13
+ MDMxMGJlY2IxZGRhYzRjYTBiYjA2ZjlkMmRhMjc5NWQ4YjE0OTEwNDYxZjgx
14
+ ZGFjMDBmMTAyYmFlYzBlMGJhMzg1MWViZDJlNGUwYTUyYzY4MzhjOWJiMzAy
15
+ MzJlMDY1OTMzNTRkYjM2Yzg3OTQ4YmU0OWE4YTAxMzFjM2FiNTA=
data/lib/cf/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cf
2
- VERSION = "3.0.1".freeze
2
+ VERSION = "4.0.0".freeze
3
3
  end
@@ -45,10 +45,6 @@ module VCAP
45
45
 
46
46
  # Common component setup for discovery and monitoring
47
47
  class Component
48
-
49
- # We will suppress these from normal varz reporting by default.
50
- CONFIG_SUPPRESS = Set.new([:message_bus_servers, :mbus, :service_mbus, :keys, :database_environment, :password, :pass, :token])
51
-
52
48
  class SafeHash < BasicObject
53
49
  def initialize(hash = {})
54
50
  @hash = hash
@@ -156,6 +152,8 @@ module VCAP
156
152
  # Returns the published configuration of the component,
157
153
  # including the ephemeral port and credentials.
158
154
  def register(opts)
155
+ disallow_exposing_of_config!(opts)
156
+
159
157
  uuid = VCAP.secure_uuid
160
158
  type = opts[:type]
161
159
  index = opts[:index]
@@ -181,7 +179,6 @@ module VCAP
181
179
  varz.synchronize do
182
180
  varz.merge!(@discover.dup)
183
181
  varz[:num_cores] = VCAP.num_cores
184
- varz[:config] = sanitize_config(opts[:config]) if opts[:config]
185
182
  varz[:log_counts] = log_counter if log_counter
186
183
  end
187
184
 
@@ -209,28 +206,11 @@ module VCAP
209
206
  @discover[:uptime] = VCAP.uptime_string(Time.now - @discover[:start])
210
207
  end
211
208
 
212
- def clear_level(h)
213
- h.each do |k, v|
214
- if CONFIG_SUPPRESS.include?(k.to_sym)
215
- h.delete(k)
216
- else
217
- clear_level(h[k]) if v.instance_of? Hash
218
- end
219
- end
220
- end
209
+ private
221
210
 
222
- def sanitize_config(config)
223
- # Can't Marshal/Deep Copy logger instances that services use
224
- if config[:logger]
225
- config = config.dup
226
- config.delete(:logger)
227
- end
228
- # Deep copy
229
- config = Marshal.load(Marshal.dump(config))
230
- clear_level(config)
231
- config
211
+ def disallow_exposing_of_config!(opts)
212
+ raise ArgumentError.new("Exposing the config is a security concern, and disallowed.") if opts.has_key?(:config)
232
213
  end
233
-
234
214
  end
235
215
  end
236
216
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vcap_common
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cloud Foundry Core Team