chamber 3.0.0rc1 → 3.0.0rc2

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
  SHA256:
3
- metadata.gz: 3119f8787d3c63913a0ab69a0114cbf6d43a154ad1703aef610a2b02720b0cbc
4
- data.tar.gz: ed25f8e4a9f93045c94aba4776fa6a0296f9db9f1312e4a1dadeb35343eba140
3
+ metadata.gz: 9de7c74ea902d381006bd6b5f05bae3680d1beef940ae75e483f30c923bc310f
4
+ data.tar.gz: b6f45eb5b668a5964e898ffb4caa5b9a3e9bc227736dd0e687e257cff0c99f84
5
5
  SHA512:
6
- metadata.gz: acc3d5daf9e6570ccf16e76b8433e8d0912cdd85f4858f6634ee37531aa6a1c53b47621afeb21c0b9524eea6f8af3a02b52872f843b28a3f94d3e20bfa582880
7
- data.tar.gz: 39a117062b19f734066f11c405730e499cc0325e6b2e3fd208aa68a930645e28f6b88f4f98e43133e8b70457d82ac3860f426b1385611b0d4b924003f79f0490
6
+ metadata.gz: b1ab7fedfaf6cb26ab3e97402966368f3e686751ca76e441a7d9db64b7fe354a289ac4ac330cac806fb7960f3b4750c1ce4f7799e548c4f0f549ee57826e8552
7
+ data.tar.gz: 64cfa0683ca78d71cd620e38e60c4d2c25683c5217d74858995b2ee65eda704f7d2aca9395451ac743424bd75b8974ee088ed3563e192be5ab057f49ad458165
checksums.yaml.gz.sig CHANGED
Binary file
@@ -20,18 +20,18 @@ class Heroku
20
20
  self.app = app
21
21
  end
22
22
 
23
- def add_environment_variable(name, value) # rubocop:disable Metrics/AbcSize
23
+ def add_environment_variable(name, value)
24
24
  value = value.gsub(/\n/, '\n') if value
25
25
  request = ::Net::HTTP::Patch.new(config_vars_uri)
26
26
 
27
27
  request['Authorization'] = "Bearer #{api_token}"
28
28
  request['Accept'] = 'application/vnd.heroku+json; version=3'
29
29
  request['Content-Type'] = 'application/json'
30
- request.body = ::JSON.dump(::Hash[name, value])
30
+ request.body = ::JSON.dump({ name => value })
31
31
 
32
32
  response = ::JSON.parse(response(request).body)
33
33
 
34
- fail ::NameError, response['message'] if response['message']
34
+ fail NameError, response['message'] if response['message']
35
35
 
36
36
  response
37
37
  end
@@ -44,7 +44,7 @@ class Heroku
44
44
 
45
45
  response = ::JSON.parse(response(request).body)
46
46
 
47
- fail ::NameError, response['message'] if response['message']
47
+ fail NameError, response['message'] if response['message']
48
48
 
49
49
  response
50
50
  end
@@ -5,13 +5,11 @@ require 'chamber/commands/cloud/clear'
5
5
  require 'chamber/commands/cloud/push'
6
6
  require 'chamber/commands/cloud/pull'
7
7
  require 'chamber/commands/cloud/compare'
8
- require 'chamber/refinements/hash'
9
8
 
10
9
  module Chamber
11
10
  module Binary
12
- class CircleCi < ::Thor
13
- include ::Thor::Actions
14
- using ::Chamber::Refinements::Hash
11
+ class CircleCi < Thor
12
+ include Thor::Actions
15
13
 
16
14
  class_option :api_token,
17
15
  type: :string,
@@ -50,7 +48,7 @@ class CircleCi < ::Thor
50
48
 
51
49
  def clear
52
50
  Commands::Cloud::Clear.call(**options
53
- .deep_transform_keys(&:to_sym)
51
+ .transform_keys(&:to_sym)
54
52
  .merge(shell: self, adapter: 'circle_ci'))
55
53
  end
56
54
 
@@ -82,7 +80,7 @@ class CircleCi < ::Thor
82
80
 
83
81
  def push
84
82
  Commands::Cloud::Push.call(**options
85
- .deep_transform_keys(&:to_sym)
83
+ .transform_keys(&:to_sym)
86
84
  .merge(shell: self, adapter: 'circle_ci'))
87
85
  end
88
86
 
@@ -97,7 +95,7 @@ class CircleCi < ::Thor
97
95
 
98
96
  def pull
99
97
  Commands::Cloud::Pull.call(**options
100
- .deep_transform_keys(&:to_sym)
98
+ .transform_keys(&:to_sym)
101
99
  .merge(shell: self, adapter: 'circle_ci'))
102
100
  end
103
101
 
@@ -115,7 +113,7 @@ class CircleCi < ::Thor
115
113
 
116
114
  def compare
117
115
  Commands::Cloud::Compare.call(**options
118
- .deep_transform_keys(&:to_sym)
116
+ .transform_keys(&:to_sym)
119
117
  .merge(shell: self, adapter: 'circle_ci'))
120
118
  end
121
119
  end
@@ -5,13 +5,11 @@ require 'chamber/commands/cloud/clear'
5
5
  require 'chamber/commands/cloud/push'
6
6
  require 'chamber/commands/cloud/pull'
7
7
  require 'chamber/commands/cloud/compare'
8
- require 'chamber/refinements/hash'
9
8
 
10
9
  module Chamber
11
10
  module Binary
12
- class Heroku < ::Thor
13
- include ::Thor::Actions
14
- using ::Chamber::Refinements::Hash
11
+ class Heroku < Thor
12
+ include Thor::Actions
15
13
 
16
14
  class_option :app,
17
15
  type: :string,
@@ -38,7 +36,7 @@ class Heroku < ::Thor
38
36
 
39
37
  def clear
40
38
  Commands::Cloud::Clear.call(**options
41
- .deep_transform_keys(&:to_sym)
39
+ .transform_keys(&:to_sym)
42
40
  .merge(shell: self, adapter: 'heroku'))
43
41
  end
44
42
 
@@ -70,7 +68,7 @@ class Heroku < ::Thor
70
68
 
71
69
  def push
72
70
  Commands::Cloud::Push.call(**options
73
- .deep_transform_keys(&:to_sym)
71
+ .transform_keys(&:to_sym)
74
72
  .merge(shell: self, adapter: 'heroku'))
75
73
  end
76
74
 
@@ -85,7 +83,7 @@ class Heroku < ::Thor
85
83
 
86
84
  def pull
87
85
  Commands::Cloud::Pull.call(**options
88
- .deep_transform_keys(&:to_sym)
86
+ .transform_keys(&:to_sym)
89
87
  .merge(shell: self, adapter: 'heroku'))
90
88
  end
91
89
 
@@ -103,7 +101,7 @@ class Heroku < ::Thor
103
101
 
104
102
  def compare
105
103
  Commands::Cloud::Compare.call(**options
106
- .deep_transform_keys(&:to_sym)
104
+ .transform_keys(&:to_sym)
107
105
  .merge(shell: self, adapter: 'heroku'))
108
106
  end
109
107
  end
@@ -12,13 +12,11 @@ require 'chamber/commands/sign'
12
12
  require 'chamber/commands/verify'
13
13
  require 'chamber/commands/compare'
14
14
  require 'chamber/commands/initialize'
15
- require 'chamber/refinements/hash'
16
15
 
17
16
  module Chamber
18
17
  module Binary
19
- class Runner < ::Thor
20
- include ::Thor::Actions
21
- using ::Chamber::Refinements::Hash
18
+ class Runner < Thor
19
+ include Thor::Actions
22
20
 
23
21
  source_root ::File.expand_path('../../../templates', __dir__)
24
22
 
@@ -94,7 +92,7 @@ class Runner < ::Thor
94
92
  'Useful for debugging.'
95
93
 
96
94
  def show
97
- puts Commands::Show.call(**options.deep_transform_keys(&:to_sym).merge(shell: self))
95
+ puts Commands::Show.call(**options.transform_keys(&:to_sym).merge(shell: self))
98
96
  end
99
97
 
100
98
  ################################################################################
@@ -102,7 +100,7 @@ class Runner < ::Thor
102
100
  desc 'files', 'Lists the settings files which are parsed with the given options'
103
101
 
104
102
  def files
105
- puts Commands::Files.call(**options.deep_transform_keys(&:to_sym).merge(shell: self))
103
+ puts Commands::Files.call(**options.transform_keys(&:to_sym).merge(shell: self))
106
104
  end
107
105
 
108
106
  ################################################################################
@@ -132,7 +130,7 @@ class Runner < ::Thor
132
130
  'destination of the comparison'
133
131
 
134
132
  def compare
135
- Commands::Compare.call(**options.deep_transform_keys(&:to_sym).merge(shell: self))
133
+ Commands::Compare.call(**options.transform_keys(&:to_sym).merge(shell: self))
136
134
  end
137
135
 
138
136
  ################################################################################
@@ -152,7 +150,7 @@ class Runner < ::Thor
152
150
  'what values would be encrypted'
153
151
 
154
152
  def secure
155
- Commands::Secure.call(**options.deep_transform_keys(&:to_sym).merge(shell: self))
153
+ Commands::Secure.call(**options.transform_keys(&:to_sym).merge(shell: self))
156
154
  end
157
155
 
158
156
  ################################################################################
@@ -171,9 +169,9 @@ class Runner < ::Thor
171
169
 
172
170
  def sign
173
171
  if options[:verify]
174
- Commands::Verify.call(**options.deep_transform_keys(&:to_sym).merge(shell: self))
172
+ Commands::Verify.call(**options.transform_keys(&:to_sym).merge(shell: self))
175
173
  else
176
- Commands::Sign.call(**options.deep_transform_keys(&:to_sym).merge(shell: self))
174
+ Commands::Sign.call(**options.transform_keys(&:to_sym).merge(shell: self))
177
175
  end
178
176
  end
179
177
 
@@ -187,7 +185,7 @@ class Runner < ::Thor
187
185
  default: false
188
186
 
189
187
  def init
190
- Commands::Initialize.call(**options.deep_transform_keys(&:to_sym).merge(shell: self))
188
+ Commands::Initialize.call(**options.transform_keys(&:to_sym).merge(shell: self))
191
189
  end
192
190
  end
193
191
  end
@@ -2,13 +2,10 @@
2
2
 
3
3
  require 'thor'
4
4
  require 'chamber/commands/travis/secure'
5
- require 'chamber/refinements/hash'
6
5
 
7
6
  module Chamber
8
7
  module Binary
9
- class Travis < ::Thor
10
- using ::Chamber::Refinements::Hash
11
-
8
+ class Travis < Thor
12
9
  desc 'secure',
13
10
  'Uses your Travis CI public key to encrypt the settings you have ' \
14
11
  'chosen not to commit to the repo'
@@ -28,9 +25,7 @@ class Travis < ::Thor
28
25
  'which are marked as "_secure"'
29
26
 
30
27
  def secure
31
- Commands::Travis::Secure.call(**options
32
- .deep_transform_keys(&:to_sym)
33
- .merge(shell: self))
28
+ Commands::Travis::Secure.call(**options.transform_keys(&:to_sym).merge(shell: self))
34
29
  end
35
30
  end
36
31
  end
@@ -194,7 +194,7 @@ class Initialize < Chamber::Commands::Base
194
194
  .chamber*.enc.pass
195
195
  !.chamber*.pub.pem
196
196
  }.each do |pattern|
197
- unless gitignore_contents =~ Regexp.new(Regexp.escape(pattern))
197
+ unless gitignore_contents&.match?(Regexp.new(Regexp.escape(pattern)))
198
198
  shell.append_to_file gitignore_filepath, "#{pattern}\n"
199
199
  end
200
200
  end
@@ -2,18 +2,15 @@
2
2
 
3
3
  require 'shellwords'
4
4
  require 'chamber/instance'
5
- require 'chamber/refinements/hash'
6
5
 
7
6
  module Chamber
8
7
  module Commands
9
8
  module Securable
10
- using ::Chamber::Refinements::Hash
11
-
12
9
  def initialize(only_sensitive: nil, **args)
13
10
  super(**args)
14
11
 
15
12
  ignored_settings_options = args
16
- .deep_merge(files: ignored_settings_filepaths)
13
+ .merge(files: ignored_settings_filepaths)
17
14
  .reject { |k, _v| k == 'basepath' }
18
15
  self.ignored_settings_instance = Chamber::Instance.new(**ignored_settings_options)
19
16
  self.current_settings_instance = Chamber::Instance.new(**args)
@@ -41,6 +41,7 @@ class ContextResolver
41
41
  options[:basepath] + 'settings*.yml',
42
42
  options[:basepath] + 'settings',
43
43
  ]
44
+
44
45
  options[:signature_name] = options[:signature_name]
45
46
 
46
47
  options
@@ -2,29 +2,41 @@
2
2
 
3
3
  require 'base64'
4
4
 
5
+ require 'chamber/errors/disallowed_class'
6
+
5
7
  module Chamber
6
8
  module EncryptionMethods
7
9
  class PublicKey
8
- def self.encrypt(_key, value, encryption_key)
10
+ def self.encrypt(_settings_key, value, encryption_key)
9
11
  value = YAML.dump(value)
10
12
  encrypted_string = encryption_key.public_encrypt(value)
11
13
 
12
14
  Base64.strict_encode64(encrypted_string)
13
15
  end
14
16
 
15
- def self.decrypt(_key, value, decryption_key)
16
- if decryption_key.nil?
17
- value
18
- else
19
- decoded_string = Base64.strict_decode64(value)
20
- unencrypted_value = decryption_key.private_decrypt(decoded_string)
21
-
22
- begin
23
- _unserialized_value = YAML.load(unencrypted_value)
24
- rescue TypeError
25
- unencrypted_value
26
- end
27
- end
17
+ def self.decrypt(_settings_key, value, decryption_key)
18
+ return value if decryption_key.nil?
19
+
20
+ decoded_string = ::Base64.strict_decode64(value)
21
+ unencrypted_value = decryption_key.private_decrypt(decoded_string)
22
+
23
+ ::YAML.safe_load(unencrypted_value,
24
+ aliases: true,
25
+ permitted_classes: [
26
+ ::Date,
27
+ ::Time,
28
+ ::Regexp,
29
+ ])
30
+ rescue ::Psych::DisallowedClass => error
31
+ raise ::Chamber::Errors::DisallowedClass, <<~HEREDOC
32
+ #{error.message}
33
+
34
+ You attempted to load a class instance via your Chamber settings that is not allowed.
35
+
36
+ See https://github.com/thekompanee/chamber/wiki/Upgrading-To-Chamber-3.0#limiting-complex-classes for full details.
37
+ HEREDOC
38
+ rescue ::TypeError
39
+ unencrypted_value
28
40
  end
29
41
  end
30
42
  end
@@ -16,7 +16,7 @@ class Ssl
16
16
  \z
17
17
  /x.freeze
18
18
 
19
- def self.encrypt(_key, value, encryption_keys) # rubocop:disable Metrics/AbcSize
19
+ def self.encrypt(_settings_key, value, encryption_keys) # rubocop:disable Metrics/AbcSize
20
20
  value = YAML.dump(value)
21
21
  cipher = OpenSSL::Cipher.new('AES-128-CBC')
22
22
  cipher.encrypt
@@ -35,38 +35,46 @@ class Ssl
35
35
  Base64.strict_encode64(encrypted_data)
36
36
  end
37
37
 
38
- def self.decrypt(key, value, decryption_keys) # rubocop:disable Metrics/AbcSize
39
- if decryption_keys.nil?
40
- value
41
- else
42
- key, iv, decoded_string = value
43
- .match(LARGE_DATA_STRING_PATTERN)
44
- .captures
45
- .map do |part|
46
- Base64.strict_decode64(part)
47
- end
48
- key = decryption_keys.private_decrypt(key)
38
+ def self.decrypt(_settings_key, value, decryption_keys) # rubocop:disable Metrics/AbcSize
39
+ return value if decryption_keys.nil?
49
40
 
50
- cipher_dec = OpenSSL::Cipher.new('AES-128-CBC')
41
+ key, iv, decoded_string = value
42
+ .match(LARGE_DATA_STRING_PATTERN)
43
+ .captures
44
+ .map do |part|
45
+ ::Base64.strict_decode64(part)
46
+ end
47
+ key = decryption_keys.private_decrypt(key)
51
48
 
52
- cipher_dec.decrypt
49
+ cipher_dec = ::OpenSSL::Cipher.new('AES-128-CBC')
53
50
 
54
- cipher_dec.key = key
55
- cipher_dec.iv = iv
51
+ cipher_dec.decrypt
56
52
 
57
- begin
58
- unencrypted_value = cipher_dec.update(decoded_string) + cipher_dec.final
59
- rescue OpenSSL::Cipher::CipherError
60
- raise Chamber::Errors::DecryptionFailure,
61
- 'A decryption error occurred. It was probably due to invalid key data.'
62
- end
53
+ cipher_dec.key = key
54
+ cipher_dec.iv = iv
63
55
 
64
- begin
65
- _unserialized_value = YAML.load(unencrypted_value)
66
- rescue TypeError
67
- unencrypted_value
68
- end
69
- end
56
+ unencrypted_value = cipher_dec.update(decoded_string) + cipher_dec.final
57
+
58
+ ::YAML.safe_load(unencrypted_value,
59
+ aliases: true,
60
+ permitted_classes: [
61
+ ::Date,
62
+ ::Time,
63
+ ::Regexp,
64
+ ])
65
+ rescue ::OpenSSL::Cipher::CipherError
66
+ raise ::Chamber::Errors::DecryptionFailure,
67
+ 'A decryption error occurred. It was probably due to invalid key data.'
68
+ rescue ::Psych::DisallowedClass => error
69
+ raise ::Chamber::Errors::DisallowedClass, <<~HEREDOC
70
+ #{error.message}
71
+
72
+ You attempted to load a class instance via your Chamber settings that is not allowed.
73
+
74
+ See https://github.com/thekompanee/chamber/wiki/Upgrading-To-Chamber-3.0#limiting-complex-classes for full details.
75
+ HEREDOC
76
+ rescue ::TypeError
77
+ unencrypted_value
70
78
  end
71
79
  end
72
80
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Chamber
4
+ module Errors
5
+ class DisallowedClass < ::Psych::DisallowedClass
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Chamber
4
+ module Errors
5
+ class NonConformingKey < ::ArgumentError
6
+ end
7
+ end
8
+ end
data/lib/chamber/file.rb CHANGED
@@ -4,7 +4,6 @@ require 'pathname'
4
4
  require 'yaml'
5
5
  require 'erb'
6
6
  require 'chamber/files/signature'
7
- require 'chamber/refinements/hash'
8
7
 
9
8
  ###
10
9
  # Internal: Represents a single file containing settings information in a given
@@ -12,8 +11,6 @@ require 'chamber/refinements/hash'
12
11
  #
13
12
  module Chamber
14
13
  class File < Pathname
15
- using ::Chamber::Refinements::Hash
16
-
17
14
  attr_accessor :namespaces,
18
15
  :decryption_keys,
19
16
  :encryption_keys,
@@ -144,10 +141,24 @@ class File < Pathname
144
141
 
145
142
  def file_contents_hash
146
143
  file_contents = read
147
- erb_result = ERB.new(file_contents).result
148
-
149
- (YAML.load(erb_result) || {}).deep_transform_keys(&:to_s)
150
- rescue Errno::ENOENT
144
+ erb_result = ::ERB.new(file_contents).result
145
+
146
+ ::YAML.safe_load(erb_result,
147
+ aliases: true,
148
+ permitted_classes: [
149
+ ::Date,
150
+ ::Time,
151
+ ::Regexp,
152
+ ]) || {}
153
+ rescue ::Psych::DisallowedClass => error
154
+ raise ::Chamber::Errors::DisallowedClass, <<~HEREDOC
155
+ #{error.message}
156
+
157
+ You attempted to load a class instance via your Chamber settings that is not allowed.
158
+
159
+ See https://github.com/thekompanee/chamber/wiki/Upgrading-To-Chamber-3.0#limiting-complex-classes for full details.
160
+ HEREDOC
161
+ rescue ::Errno::ENOENT
151
162
  {}
152
163
  end
153
164
  end
@@ -256,9 +256,15 @@ class FileSet
256
256
 
257
257
  private
258
258
 
259
+ # rubocop:disable Performance/ChainArrayAllocation
259
260
  def all_files
260
- @all_files ||= file_globs.map { |fg| Pathname.glob(fg) }.flatten.uniq.sort # rubocop:disable Performance/ChainArrayAllocation
261
+ @all_files ||= file_globs
262
+ .map { |fg| Pathname.glob(fg) }
263
+ .flatten
264
+ .uniq
265
+ .sort
261
266
  end
267
+ # rubocop:enable Performance/ChainArrayAllocation
262
268
 
263
269
  def non_namespaced_files
264
270
  @non_namespaced_files ||= all_files - namespaced_files
@@ -42,13 +42,13 @@ class Signature
42
42
  end
43
43
 
44
44
  def write
45
- signature_filename.write(<<-HEREDOC, 0, mode: 'w+')
46
- Signed By: #{signature_name}
47
- Signed At: #{Time.now.utc.iso8601}
45
+ signature_filename.write(<<~HEREDOC, 0, mode: 'w+')
46
+ Signed By: #{signature_name}
47
+ Signed At: #{Time.now.utc.iso8601}
48
48
 
49
- #{SIGNATURE_HEADER}
50
- #{encoded_signature}
51
- #{SIGNATURE_FOOTER}
49
+ #{SIGNATURE_HEADER}
50
+ #{encoded_signature}
51
+ #{SIGNATURE_FOOTER}
52
52
  HEREDOC
53
53
  end
54
54
 
@@ -36,7 +36,7 @@ class DecryptionFilter
36
36
  attr_reader :decryption_keys
37
37
 
38
38
  def initialize(data:, secure_key_prefix:, decryption_keys: {}, **_args)
39
- self.decryption_keys = decryption_keys || {}
39
+ self.decryption_keys = (decryption_keys || {}).transform_keys(&:to_s)
40
40
  self.data = data.deep_dup
41
41
  self.secure_key_token = /\A#{Regexp.escape(secure_key_prefix)}/
42
42
  end
@@ -81,18 +81,16 @@ class DecryptionFilter
81
81
  method = decryption_method(value)
82
82
 
83
83
  decryption_keys.each do |decryption_key|
84
- begin
85
- return method.decrypt(key, value, decryption_key)
86
- rescue OpenSSL::PKey::RSAError
87
- next
88
- end
84
+ return method.decrypt(key, value, decryption_key)
85
+ rescue OpenSSL::PKey::RSAError
86
+ next
89
87
  end
90
88
 
91
89
  value
92
90
  end
93
91
 
94
92
  def decryption_method(value)
95
- if value.respond_to?(:match)
93
+ if value.is_a?(::String)
96
94
  if value.match(BASE64_STRING_PATTERN)
97
95
  EncryptionMethods::PublicKey
98
96
  elsif value.match(LARGE_DATA_STRING_PATTERN)
@@ -29,7 +29,7 @@ class EncryptionFilter
29
29
  attr_reader :encryption_keys
30
30
 
31
31
  def initialize(data:, secure_key_prefix:, encryption_keys: {}, **_args)
32
- self.encryption_keys = encryption_keys || {}
32
+ self.encryption_keys = (encryption_keys || {}).transform_keys(&:to_s)
33
33
  self.data = data.deep_dup
34
34
  self.secure_key_token = /\A#{Regexp.escape(secure_key_prefix)}/
35
35
  end
@@ -53,7 +53,7 @@ class EncryptionFilter
53
53
  end
54
54
 
55
55
  def encryption_keys=(other)
56
- @encryption_keys = other.each_with_object({}) do |(namespace, keyish), memo|
56
+ @encryption_keys = other.each_with_object({}) do |(namespace, keyish), memo| # rubocop:disable Style/HashTransformValues
57
57
  memo[namespace] = if keyish.is_a?(OpenSSL::PKey::RSA)
58
58
  keyish
59
59
  elsif ::File.readable?(::File.expand_path(keyish))
@@ -69,8 +69,7 @@ class EncryptionFilter
69
69
 
70
70
  def encrypt(namespace, key, value)
71
71
  method = encryption_method(value)
72
- namespace_key = namespace ? namespace.to_sym : nil
73
- encryption_key = encryption_keys[namespace_key] || encryption_keys[:__default]
72
+ encryption_key = encryption_keys[namespace] || encryption_keys['__default']
74
73
 
75
74
  return value unless encryption_key
76
75
 
@@ -78,7 +77,7 @@ class EncryptionFilter
78
77
  end
79
78
 
80
79
  def encryption_method(value)
81
- value_is_encrypted = value.respond_to?(:match) &&
80
+ value_is_encrypted = value.is_a?(::String) &&
82
81
  (value.match(BASE64_STRING_PATTERN) ||
83
82
  value.match(LARGE_DATA_STRING_PATTERN))
84
83
 
@@ -1,16 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'yaml'
4
+
4
5
  require 'chamber/errors/environment_conversion'
5
- require 'chamber/refinements/hash'
6
- require 'chamber/refinements/deep_dup'
7
6
 
8
7
  module Chamber
9
8
  module Filters
10
9
  class EnvironmentFilter
11
- using ::Chamber::Refinements::Hash
12
- using ::Chamber::Refinements::DeepDup
13
-
14
10
  ###
15
11
  # Internal: Allows the existing environment to be injected into the passed in
16
12
  # hash. The hash that is passed in is *not* modified, instead a new hash is
@@ -113,9 +109,11 @@ class EnvironmentFilter
113
109
  { key => execute(value, environment_keys) }
114
110
  end,
115
111
  lambda do |key, value, environment_key|
116
- { key => convert_environment_value(environment_key,
112
+ {
113
+ key => convert_environment_value(environment_key,
117
114
  ENV[environment_key],
118
- value) }
115
+ value),
116
+ }
119
117
  end,
120
118
  )
121
119
  end
@@ -127,14 +125,14 @@ class EnvironmentFilter
127
125
 
128
126
  settings.each_pair do |key, value|
129
127
  environment_key = key.to_s.gsub(secure_key_token, '')
130
- environment_keys = parent_keys.deep_dup.push(environment_key)
128
+ environment_keys = parent_keys.dup.push(environment_key)
131
129
 
132
130
  if value.respond_to? :each_pair
133
- environment_hash.deep_merge!(hash_block.call(key, value, environment_keys))
131
+ environment_hash.merge!(hash_block.call(key, value, environment_keys))
134
132
  else
135
133
  environment_key = environment_keys.join('_').upcase
136
134
 
137
- environment_hash.deep_merge!(value_block.call(key, value, environment_key))
135
+ environment_hash.merge!(value_block.call(key, value, environment_key))
138
136
  end
139
137
  end
140
138
 
@@ -171,13 +169,13 @@ class EnvironmentFilter
171
169
  environment_value
172
170
  end
173
171
  rescue ArgumentError
174
- raise Chamber::Errors::EnvironmentConversion, <<-HEREDOC
175
- We attempted to convert '#{environment_key}' from '#{environment_value}' to a '#{settings_value.class.name}'.
172
+ raise Chamber::Errors::EnvironmentConversion, <<~HEREDOC
173
+ We attempted to convert '#{environment_key}' from '#{environment_value}' to a '#{settings_value.class.name}'.
176
174
 
177
- Unfortunately, this did not go as planned. Please either verify that your value is convertable
178
- or change the original YAML value to be something more generic (like a String).
175
+ Unfortunately, this did not go as planned. Please either verify that your value is convertable
176
+ or change the original YAML value to be something more generic (like a String).
179
177
 
180
- For more information, see https://github.com/thekompanee/chamber/wiki/Environment-Variable-Coercions
178
+ For more information, see https://github.com/thekompanee/chamber/wiki/Environment-Variable-Coercions
181
179
  HEREDOC
182
180
  end
183
181
  end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'chamber/refinements/hash'
4
3
  require 'chamber/refinements/deep_dup'
4
+ require 'chamber/refinements/hash'
5
5
 
6
6
  module Chamber
7
7
  module Filters
8
8
  class NamespaceFilter
9
- using ::Chamber::Refinements::Hash
10
9
  using ::Chamber::Refinements::DeepDup
10
+ using ::Chamber::Refinements::Hash
11
11
 
12
12
  def self.execute(**args)
13
13
  new(**args).__send__(:execute)
@@ -24,19 +24,17 @@ class NamespaceFilter
24
24
  protected
25
25
 
26
26
  def execute
27
- if data_is_namespaced?
28
- namespaces.each_with_object({}) do |namespace, filtered_data|
29
- filtered_data.deep_merge!(data[namespace]) if data[namespace]
30
- end
31
- else
32
- data
27
+ return data unless data_is_namespaced?
28
+
29
+ namespaces.each_with_object({}) do |namespace, filtered_data|
30
+ filtered_data.deep_merge!(data[namespace]) if data[namespace]
33
31
  end
34
32
  end
35
33
 
36
34
  private
37
35
 
38
36
  def data_is_namespaced?
39
- @data_is_namespaced ||= data.keys.any? { |key| namespaces.include? key.to_s }
37
+ @data_is_namespaced ||= data.keys.any? { |key| namespaces.include?(key.to_s) }
40
38
  end
41
39
  end
42
40
  end
@@ -3,12 +3,9 @@
3
3
  require 'chamber/configuration'
4
4
  require 'chamber/file_set'
5
5
  require 'chamber/settings'
6
- require 'chamber/refinements/hash'
7
6
 
8
7
  module Chamber
9
8
  class Instance
10
- using ::Chamber::Refinements::Hash
11
-
12
9
  attr_accessor :configuration,
13
10
  :files
14
11
 
@@ -66,11 +63,11 @@ class Instance
66
63
  end
67
64
 
68
65
  def encrypt(data, **args)
69
- config = configuration.to_hash.deep_merge(**args)
66
+ config = configuration.to_hash.merge(**args)
70
67
 
71
68
  Settings
72
69
  .new(
73
- **config.deep_merge(
70
+ **config.merge(
74
71
  settings: data,
75
72
  pre_filters: [Filters::EncryptionFilter],
76
73
  post_filters: [],
@@ -80,11 +77,11 @@ class Instance
80
77
  end
81
78
 
82
79
  def decrypt(data, **args)
83
- config = configuration.to_hash.deep_merge(**args)
80
+ config = configuration.to_hash.merge(**args)
84
81
 
85
82
  Settings
86
83
  .new(
87
- **config.deep_merge(
84
+ **config.merge(
88
85
  settings: data,
89
86
  pre_filters: [Filters::NamespaceFilter],
90
87
  post_filters: [
@@ -39,13 +39,13 @@ class Base
39
39
  namespaces.map { |n| namespace_to_key_path(n) }
40
40
  end
41
41
 
42
- # rubocop:disable Performance/ChainArrayAllocation
42
+ # rubocop:disable Performance/ChainArrayAllocation, Performance/MapCompact
43
43
  def filenames=(other)
44
44
  @filenames = Array(other)
45
45
  .map { |o| Pathname.new(o) }
46
46
  .compact
47
47
  end
48
- # rubocop:enable Performance/ChainArrayAllocation
48
+ # rubocop:enable Performance/ChainArrayAllocation, Performance/MapCompact
49
49
 
50
50
  def namespaces=(other)
51
51
  @namespaces = other + %w{signature}
@@ -4,50 +4,26 @@ module Chamber
4
4
  module Refinements
5
5
  module DeepDup
6
6
  refine ::Array do
7
- unless method_defined?(:deep_dup)
8
- def deep_dup
9
- map do |i|
10
- if i.respond_to?(:deep_dup)
11
- i.deep_dup
12
- else
13
- begin
14
- i.dup
15
- rescue ::TypeError
16
- # Hack for < Ruby 2.4 since FalseClass, TrueClass, Fixnum, etc can't be
17
- # dupped
18
- i
19
- end
20
- end
21
- end
22
- end
7
+ def deep_dup
8
+ map { |i| i.respond_to?(:deep_dup) ? i.deep_dup : i.dup }
23
9
  end
24
10
  end
25
11
 
26
12
  refine ::Object do
27
- unless method_defined?(:deep_dup)
28
- def deep_dup
29
- begin
30
- dup
31
- rescue ::TypeError
32
- # Hack for < Ruby 2.4 since FalseClass, TrueClass, Fixnum, etc can't be
33
- # dupped
34
- self
35
- end
36
- end
13
+ def deep_dup
14
+ dup
37
15
  end
38
16
  end
39
17
 
40
18
  refine ::Hash do
41
- unless method_defined?(:deep_dup)
42
- def deep_dup
43
- dup.tap do |hash|
44
- each_pair do |key, value|
45
- if key.frozen? && key.is_a?(::String)
46
- hash[key] = value.deep_dup
47
- else
48
- hash.delete(key)
49
- hash[key.deep_dup] = value.deep_dup
50
- end
19
+ def deep_dup
20
+ dup.tap do |hash|
21
+ each_pair do |key, value|
22
+ if key.frozen? && key.is_a?(::String)
23
+ hash[key] = value.deep_dup
24
+ else
25
+ hash.delete(key)
26
+ hash[key.deep_dup] = value.deep_dup
51
27
  end
52
28
  end
53
29
  end
@@ -1,34 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'chamber/errors/non_conforming_key'
4
+
3
5
  module Chamber
4
6
  module Refinements
5
7
  class Enumerable
6
- def self.deep_transform_keys(object, &block)
8
+ def self.deep_validate_keys(object, &block)
7
9
  case object
8
10
  when ::Hash
9
- object.each_with_object({}) do |(key, value), result|
10
- result[yield(key)] = deep_transform_keys(value, &block)
11
- end
12
- when ::Array
13
- object.map { |e| deep_transform_keys(e, &block) }
14
- else
15
- object
16
- end
17
- end
11
+ object.each do |(key, value)|
12
+ fail ::Chamber::Errors::NonConformingKey unless key == yield(key)
18
13
 
19
- def self.deep_transform_values(key, value, &block)
20
- case value
21
- when ::Hash
22
- value.each_with_object({}) do |(k, v), memo|
23
- memo[k] = deep_transform_values(k, v, &block)
14
+ deep_validate_keys(value, &block)
24
15
  end
25
16
  when ::Array
26
- yield(
27
- key,
28
- value.map { |v| deep_transform_values(nil, v, &block) }
29
- )
17
+ object.map { |v| deep_validate_keys(v, &block) }
30
18
  else
31
- yield(key, value)
19
+ object
32
20
  end
33
21
  end
34
22
  end
@@ -1,47 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rspectacular'
4
- require 'chamber/refinements/hash'
5
- require 'chamber/refinements/enumerable'
6
-
7
3
  module Chamber
8
4
  module Refinements
9
5
  module Hash
10
6
  refine ::Hash do
11
- def deep_strip!
12
- each do |key, value|
13
- if value.respond_to?(:strip)
14
- self[key] = value.strip
15
- elsif value.respond_to?(:deep_strip!)
16
- self[key] = value.deep_strip!
17
- end
18
- end
19
- end
20
-
21
- def deep_transform_keys(&block)
22
- Refinements::Enumerable.deep_transform_keys(self, &block)
23
- end
24
-
25
- def deep_transform_values(&block)
26
- Refinements::Enumerable.deep_transform_values(nil, self, &block)
27
- end
28
-
29
- unless method_defined?(:deep_merge)
30
- def deep_merge(other, &block)
31
- dup.deep_merge!(other, &block)
32
- end
7
+ def deep_merge(other_hash, &block)
8
+ dup.deep_merge!(other_hash, &block)
33
9
  end
34
10
 
35
- unless method_defined?(:deep_merge!)
36
- def deep_merge!(other, &block)
37
- merge!(other) do |key, value_1, value_2|
38
- if value_1.is_a?(::Hash) && value_2.is_a?(::Hash)
39
- value_1.deep_merge(value_2, &block)
40
- elsif block
41
- yield(key, value_1, value_2)
42
- else
43
- value_2
44
- end
11
+ def deep_merge!(other_hash, &block)
12
+ merge!(other_hash) do |key, this_val, other_val|
13
+ if this_val.is_a?(::Hash) && other_val.is_a?(::Hash)
14
+ this_val.deep_merge(other_val, &block)
15
+ elsif block
16
+ yield(key, this_val, other_val)
17
+ else
18
+ other_val
45
19
  end
46
20
  end
47
21
  end
@@ -5,7 +5,7 @@ require 'pathname'
5
5
  unless Pathname.instance_methods.include?(:write)
6
6
  class Pathname
7
7
  def write(*args)
8
- IO.write @path, *args
8
+ IO.write @path, *args # rubocop:disable Security/IoMethods
9
9
  end
10
10
  end
11
11
  end
@@ -10,6 +10,7 @@ require 'chamber/filters/translate_secure_keys_filter'
10
10
  require 'chamber/filters/insecure_filter'
11
11
  require 'chamber/filters/failed_decryption_filter'
12
12
  require 'chamber/refinements/deep_dup'
13
+ require 'chamber/refinements/enumerable'
13
14
  require 'chamber/refinements/hash'
14
15
 
15
16
  ###
@@ -26,7 +27,6 @@ class Settings
26
27
  :pre_filters,
27
28
  :secure_key_prefix
28
29
  attr_reader :namespaces
29
- attr_writer :raw_data
30
30
 
31
31
  # rubocop:disable Metrics/ParameterLists
32
32
  def initialize(
@@ -46,9 +46,12 @@ class Settings
46
46
  settings: {},
47
47
  **_args
48
48
  )
49
- self.decryption_keys = decryption_keys
50
- self.encryption_keys = encryption_keys
51
- self.namespaces = namespaces
49
+
50
+ ::Chamber::Refinements::Enumerable.deep_validate_keys(settings, &:to_s)
51
+
52
+ self.decryption_keys = (decryption_keys || {}).transform_keys(&:to_s)
53
+ self.encryption_keys = (encryption_keys || {}).transform_keys(&:to_s)
54
+ self.namespaces = NamespaceSet.new(namespaces)
52
55
  self.post_filters = post_filters
53
56
  self.pre_filters = pre_filters
54
57
  self.raw_data = settings.deep_dup
@@ -114,7 +117,7 @@ class Settings
114
117
  # Returns a Hash
115
118
  #
116
119
  def to_hash
117
- data.dup
120
+ data.deep_dup
118
121
  end
119
122
 
120
123
  ###
@@ -147,11 +150,11 @@ class Settings
147
150
  flattened_name_hash = {}
148
151
 
149
152
  hash.each_pair do |key, value|
150
- flattened_name_components = parent_keys.deep_dup.push(key)
153
+ flattened_name_components = parent_keys.dup.push(key)
151
154
 
152
155
  if value.respond_to?(:each_pair)
153
- flattened_name_hash
154
- .deep_merge!(to_flattened_name_hash(value, flattened_name_components))
156
+ flattened_name_hash.merge! to_flattened_name_hash(value,
157
+ flattened_name_components)
155
158
  else
156
159
  flattened_name_hash[flattened_name_components] = value
157
160
  end
@@ -197,7 +200,7 @@ class Settings
197
200
  other_settings = case other
198
201
  when Settings
199
202
  other
200
- when ::Hash
203
+ when Hash
201
204
  Settings.new(settings: other)
202
205
  end
203
206
 
@@ -233,8 +236,7 @@ class Settings
233
236
  end
234
237
 
235
238
  def [](key)
236
- warn "WARNING: Bracket access will require strings instead of symbols in Chamber 3.0. You attempted to access the '#{key}' setting. See https://github.com/thekompanee/chamber/wiki/Upgrading-To-Chamber-3.0#removal-of-bracket-indifferent-access for full details." if key.is_a?(::Symbol) # rubocop:disable Layout/LineLength
237
- warn "WARNING: Accessing a non-existent key ('#{key}') with brackets will fail in Chamber 3.0. See https://github.com/thekompanee/chamber/wiki/Upgrading-To-Chamber-3.0#bracket-access-now-fails-on-non-existent-keys for full details." unless data.has_key?(key) # rubocop:disable Layout/LineLength
239
+ fail ::ArgumentError, 'Bracket access with anything other than a String is unsupported.' unless key.is_a?(::String)
238
240
 
239
241
  data.fetch(key)
240
242
  end
@@ -254,14 +256,14 @@ class Settings
254
256
  end
255
257
 
256
258
  def securable
257
- Settings.new(**metadata.deep_merge(
259
+ Settings.new(**metadata.merge(
258
260
  settings: raw_data,
259
261
  pre_filters: [Filters::SecureFilter],
260
262
  ))
261
263
  end
262
264
 
263
265
  def secure
264
- Settings.new(**metadata.deep_merge(
266
+ Settings.new(**metadata.merge(
265
267
  settings: raw_data,
266
268
  pre_filters: [Filters::EncryptionFilter],
267
269
  post_filters: [Filters::TranslateSecureKeysFilter],
@@ -269,7 +271,7 @@ class Settings
269
271
  end
270
272
 
271
273
  def insecure
272
- Settings.new(**metadata.deep_merge(
274
+ Settings.new(**metadata.merge(
273
275
  settings: raw_data,
274
276
  pre_filters: [Filters::InsecureFilter],
275
277
  post_filters: [Filters::TranslateSecureKeysFilter],
@@ -278,23 +280,21 @@ class Settings
278
280
 
279
281
  protected
280
282
 
281
- def namespaces=(raw_namespaces)
282
- @namespaces = NamespaceSet.new(raw_namespaces)
283
- end
283
+ attr_writer :namespaces,
284
+ :raw_data
284
285
 
285
286
  # rubocop:disable Naming/MemoizedInstanceVariableName
286
287
  def raw_data
287
288
  @filtered_raw_data ||= pre_filters.inject(@raw_data) do |filtered_data, filter|
288
- filter.execute(**{ data: filtered_data }.deep_merge(metadata))
289
+ filter.execute(**{ data: filtered_data }.merge(metadata))
289
290
  end
290
291
  end
291
292
  # rubocop:enable Naming/MemoizedInstanceVariableName
292
293
 
293
294
  def data
294
- @data ||= post_filters
295
- .inject(raw_data) do |filtered_data, filter|
296
- filter.execute(**{ data: filtered_data }.deep_merge(metadata))
297
- end
295
+ @data ||= post_filters.inject(raw_data) do |filtered_data, filter|
296
+ filter.execute(**{ data: filtered_data }.merge(metadata))
297
+ end
298
298
  end
299
299
 
300
300
  def metadata
@@ -37,14 +37,14 @@ class Secured < CHAMBER_TYPE_VALUE_SUPERCLASS
37
37
 
38
38
  def cast(value)
39
39
  case value
40
- when ::Hash
40
+ when Hash
41
41
  value
42
- when ::String
42
+ when String
43
43
  ::JSON.parse(value)
44
- when ::NilClass
44
+ when NilClass
45
45
  nil
46
46
  else
47
- fail ::ArgumentError, 'Any attributes encrypted with Chamber must be either a Hash or a valid JSON string'
47
+ fail ArgumentError, 'Any attributes encrypted with Chamber must be either a Hash or a valid JSON string'
48
48
  end
49
49
  end
50
50
  alias type_cast_from_user cast
@@ -54,14 +54,14 @@ class Secured < CHAMBER_TYPE_VALUE_SUPERCLASS
54
54
 
55
55
  return if value.nil?
56
56
 
57
- ::Chamber.decrypt(value,
58
- decryption_keys: decryption_keys,
59
- encryption_keys: encryption_keys)
57
+ Chamber.decrypt(value,
58
+ decryption_keys: decryption_keys,
59
+ encryption_keys: encryption_keys)
60
60
  end
61
61
  alias type_cast_from_database deserialize
62
62
 
63
63
  def serialize(value)
64
- fail ::ArgumentError, 'Any attributes encrypted with Chamber must be a Hash' unless value.is_a?(::Hash)
64
+ fail ArgumentError, 'Any attributes encrypted with Chamber must be a Hash' unless value.is_a?(Hash)
65
65
 
66
66
  ::JSON.dump(
67
67
  ::Chamber.encrypt(value,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Chamber
4
- VERSION = '3.0.0rc1'
4
+ VERSION = '3.0.0rc2'
5
5
  end
data/lib/chamber.rb CHANGED
@@ -11,10 +11,6 @@ module Chamber
11
11
  self.instance = Instance.new(**args)
12
12
  end
13
13
 
14
- def env
15
- instance.settings
16
- end
17
-
18
14
  def instance
19
15
  @instance ||= Instance.new
20
16
  end
@@ -87,7 +83,6 @@ module Chamber
87
83
  :dig!,
88
84
  :dig,
89
85
  :encrypt,
90
- :env,
91
86
  :filenames,
92
87
  :files,
93
88
  :instance,
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,21 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chamber
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0rc1
4
+ version: 3.0.0rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - thekompanee
8
8
  - jfelchner
9
9
  - stevenhallen
10
10
  - m5rk
11
- autorequire:
11
+ autorequire:
12
12
  bindir: bin
13
13
  cert_chain:
14
14
  - |
15
15
  -----BEGIN CERTIFICATE-----
16
- MIIEGDCCAoCgAwIBAgIBAjANBgkqhkiG9w0BAQsFADAyMTAwLgYDVQQDDCdhY2Nv
17
- dW50c19ydWJ5Z2Vtcy9EQz10aGVrb21wYW5lZS9EQz1jb20wHhcNMjAxMjI2MjIy
18
- NTE5WhcNMjExMjI2MjIyNTE5WjAyMTAwLgYDVQQDDCdhY2NvdW50c19ydWJ5Z2Vt
16
+ MIIEdjCCAt6gAwIBAgIBATANBgkqhkiG9w0BAQsFADAyMTAwLgYDVQQDDCdhY2Nv
17
+ dW50c19ydWJ5Z2Vtcy9EQz10aGVrb21wYW5lZS9EQz1jb20wHhcNMjIwMzA1MjM0
18
+ OTEzWhcNMjMwMzA1MjM0OTEzWjAyMTAwLgYDVQQDDCdhY2NvdW50c19ydWJ5Z2Vt
19
19
  cy9EQz10aGVrb21wYW5lZS9EQz1jb20wggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAw
20
20
  ggGKAoIBgQD0Z84PxtE0iiWCMTQbnit6D4w55GGBQZnhpWUCJwC0SpQ/jnT0Fsma
21
21
  g8oAIdDclLvLC9jzqSAmkOujlpkJMb5NabgkhKFwHi6cVW/gz/cVnISAv8LQTIM5
@@ -25,18 +25,20 @@ cert_chain:
25
25
  NBRKSuO15kpPo2G55N0HLy8abUzbu5cqjhSbIk9hzD6AmdGCT4DqlsdHI5gOrGP0
26
26
  BO6VxGpRuRETKoZ4epPCsXC2XAwk3TJXkuuqYkgdcv8ZR4rPW2CiPvRqgG1YVwWj
27
27
  SrIy5Dt/dlMvxdIMiTj6ytAQP1kfdKPFWrJTIA2tspl/eNB+LiYsVdj8d0UU/KTY
28
- y7jqKMpOE1UCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
29
- BBYEFO/l0LjdONn2Rr8y4WGyMA37MWVfMA0GCSqGSIb3DQEBCwUAA4IBgQDBGn+T
30
- HS7SCuLgjCimsT5e3v+Q0VaML1+yJPPqvIVM+HMyTYDpV2ogdAcX1I0lNbUHT9w7
31
- 5y8pQ7BtYq8LDX6D8EufjvlgpJzunuPpNVh2QQdtkYC2zGabTnk+BJC5scYckBxW
32
- PxYXSuOxjXAkFe1r9RhPzeMY8lPVh6aEQKNLVkzbpIjoGzUgAPGPZG/ylKSWycwE
33
- qfHiDXzCAqMzSsb3sMQO1+0euciY1oTOyYCHYKo+gemWEI/p8PyJe/qB2tWC9GYs
34
- m+we5ul7O4Sq8qKnX0KCqHneqaXakcbuEkhViW6Def432jH8JjYums6EW2mg9570
35
- pHS20TH4u9o0+5DIhayfGrmAtdtQutQNCclONqBlk7r3/16Y8Lr376dDHrISZlwd
36
- fdbUKgJXqJeb4GYhiKV07l67XExVjmAklMuA6bcB7mk+aSYUkoWNic4ZYGNjVv88
37
- AapqLKNG/UPfrJhdhTtFR4ARb8f54rgzONhTaAqVk23Bdp1yoDXaulFCkmU=
28
+ y7jqKMpOE1UCAwEAAaOBljCBkzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNV
29
+ HQ4EFgQU7+XQuN042fZGvzLhYbIwDfsxZV8wLAYDVR0RBCUwI4EhYWNjb3VudHMr
30
+ cnVieWdlbXNAdGhla29tcGFuZWUuY29tMCwGA1UdEgQlMCOBIWFjY291bnRzK3J1
31
+ YnlnZW1zQHRoZWtvbXBhbmVlLmNvbTANBgkqhkiG9w0BAQsFAAOCAYEA04F3jVFD
32
+ BwHv8GVMkvUAc7r247lEEYfYuU/Iq0fivT1ugxN9pqT/ODwyPSdYy4Aqj8j4HHbM
33
+ 2OQcKXb9SXjlIa/u5McPlhbsTQozs77bXOmrlAXN6shRJtTKSKm5ttmM/sDeks6p
34
+ wdhM0KHu5PBFZQjWfJuqi0hH13l0qQH+8r2GzXTHMKNX+6m1cTAkP81OPFIekn0l
35
+ boFRgsIr1j335pLV/+hgCRNSlU84E59YVVm+W9kP0Ym/n6051mBaaEMsWnm3td7a
36
+ c7BNPTxfmZrtz3TVq9VvzdHad3/+1QdNl9+l3VdL7wZ3GKZLhyifn7dc5EXxiZHJ
37
+ eDcSScq4x5NTMajXoJLKcoQPJDL7rUpPtvGj3v9O20RzHlWVDqVdzeYlswDjIqwe
38
+ ZjvLRaDI6IVoq0skZju//VZLiN6slVhAYYQj0uka/T0DZieabVYDcT4BVpa9M7Gz
39
+ CDW/VDWjvEEbsCIW0oYhtUrkqE8GLIdrpLUjefOERbS5TslD7lG/MH5k
38
40
  -----END CERTIFICATE-----
39
- date: 2020-12-31 00:00:00.000000000 Z
41
+ date: 2022-03-06 00:00:00.000000000 Z
40
42
  dependencies:
41
43
  - !ruby/object:Gem::Dependency
42
44
  name: thor
@@ -171,7 +173,9 @@ files:
171
173
  - lib/chamber/encryption_methods/public_key.rb
172
174
  - lib/chamber/encryption_methods/ssl.rb
173
175
  - lib/chamber/errors/decryption_failure.rb
176
+ - lib/chamber/errors/disallowed_class.rb
174
177
  - lib/chamber/errors/environment_conversion.rb
178
+ - lib/chamber/errors/non_conforming_key.rb
175
179
  - lib/chamber/file.rb
176
180
  - lib/chamber/file_set.rb
177
181
  - lib/chamber/files/signature.rb
@@ -192,7 +196,6 @@ files:
192
196
  - lib/chamber/keys/encryption.rb
193
197
  - lib/chamber/namespace_set.rb
194
198
  - lib/chamber/rails.rb
195
- - lib/chamber/refinements/array.rb
196
199
  - lib/chamber/refinements/deep_dup.rb
197
200
  - lib/chamber/refinements/enumerable.rb
198
201
  - lib/chamber/refinements/hash.rb
@@ -212,7 +215,7 @@ metadata:
212
215
  homepage_uri: https://github.com/thekompanee/chamber
213
216
  source_code_uri: https://github.com/thekompanee/chamber
214
217
  wiki_uri: https://github.com/thekompanee/chamber/wiki
215
- post_install_message:
218
+ post_install_message:
216
219
  rdoc_options: []
217
220
  require_paths:
218
221
  - lib
@@ -220,15 +223,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
220
223
  requirements:
221
224
  - - ">="
222
225
  - !ruby/object:Gem::Version
223
- version: 2.1.0
226
+ version: 2.7.5
224
227
  required_rubygems_version: !ruby/object:Gem::Requirement
225
228
  requirements:
226
229
  - - ">"
227
230
  - !ruby/object:Gem::Version
228
231
  version: 1.3.1
229
232
  requirements: []
230
- rubygems_version: 3.2.3
231
- signing_key:
233
+ rubygems_version: 3.1.6
234
+ signing_key:
232
235
  specification_version: 4
233
236
  summary: A surprisingly configurable convention-based approach to managing your application's
234
237
  custom configuration settings.
metadata.gz.sig CHANGED
Binary file
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rspectacular'
4
- require 'chamber/refinements/enumerable'
5
-
6
- module Chamber
7
- module Refinements
8
- module Array
9
- refine ::Array do
10
- def deep_transform_keys(&block)
11
- Refinements::Enumerable.deep_transform_keys(self, &block)
12
- end
13
-
14
- def deep_transform_values(&block)
15
- Refinements::Enumerable.deep_transform_values(nil, self, &block)
16
- end
17
- end
18
- end
19
- end
20
- end