chamber 2.1.1 → 2.1.2

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: 6c171312ecac24f9a59536b4d87f9800a96b3c5f
4
- data.tar.gz: 544ce7b7a75978be13165504531562b89dfab79d
3
+ metadata.gz: e9de216ad1436860f46bcb75029b0194aa847ce2
4
+ data.tar.gz: 2b2a26a9aaf8e576030df7bde02f84ef05378706
5
5
  SHA512:
6
- metadata.gz: b49b85ca44bfab420bab4f96e7e961d9cf7a11af85378a8af7b2fe00484aa3425cc9cc52b33020d782344d23efeefa58f978fd1713f79704ac36aab39a4f0672
7
- data.tar.gz: f141a6d4b1eaabcb07ff819e278ee4711237f1a82b8f20f96ddbad4ae7b2852432a901620e98c64c5c9ae73f0b4108a3c7afb08255e1bcf769543dcc4de85e01
6
+ metadata.gz: fe8ffda84ce3be57878e064f4080e75e712e8c6b09fd82362a5fd4e65dd85dd2668e620a205345d42397a91939abc242345cf9c23e1b8773c4e67c40be0b49e5
7
+ data.tar.gz: 3c3e50d76377142e1bf16a2a7a1d7951d69e2b4c061121428cfa4caae490185589a0c714edd1ae3c1d748c4442f514ccbaf4ce46c4641d253cab17dab4536125
@@ -33,8 +33,12 @@ class DecryptionFilter
33
33
  if key.match(SECURE_KEY_TOKEN)
34
34
  key = key.to_s.sub(SECURE_KEY_TOKEN, '')
35
35
  value = if value.match(BASE64_STRING_PATTERN)
36
- decoded_string = Base64.strict_decode64(value)
37
- decryption_key.private_decrypt(decoded_string)
36
+ if decryption_key.nil?
37
+ value
38
+ else
39
+ decoded_string = Base64.strict_decode64(value)
40
+ decryption_key.private_decrypt(decoded_string)
41
+ end
38
42
  else
39
43
  warn "WARNING: It appears that you would like to keep your information for #{key} secure, however the value for that setting does not appear to be encrypted. Make sure you run 'chamber settings secure' before committing."
40
44
 
@@ -1,3 +1,3 @@
1
1
  module Chamber
2
- VERSION = '2.1.1'
2
+ VERSION = '2.1.2'
3
3
  end
@@ -1,5 +1,6 @@
1
1
  require 'rspectacular'
2
2
  require 'chamber/commands/secure'
3
+ require 'fileutils'
3
4
 
4
5
  module Chamber
5
6
  module Commands
@@ -11,6 +12,7 @@ describe Secure do
11
12
  encryption_key: rootpath + '../spec_key'} }
12
13
 
13
14
  it 'can return values formatted as environment variables' do
15
+ ::FileUtils.mkdir_p rootpath + 'settings' unless ::File.exist? rootpath + 'settings'
14
16
  ::File.open(settings_filename, 'w') do |file|
15
17
  file.write <<-HEREDOC
16
18
  test:
@@ -43,6 +43,13 @@ describe DecryptionFilter do
43
43
 
44
44
  expect(filtered_settings.my_secure_setting).to eql 'hello'
45
45
  end
46
+
47
+ it 'simply returns the encrypted string if there is no decryption key' do
48
+ filtered_settings = DecryptionFilter.execute( data: {
49
+ _secure_my_secure_setting: 'cJbFe0NI5wknmsp2fVgpC/YeBD2pvcdVD+p0pUdnMoYThaV4mpsspg/ZTBtmjx7kMwcF6cjXFLDVw3FxptTHwzJUd4akun6EZ57m+QzCMJYnfY95gB2/emEAQLSz4/YwsE4LDGydkEjY1ZprfXznf+rU31YGDJUTf34ESz7fsQGSc9DjkBb9ao8Mv4cI7pCXkQZDwS5kLAZDf6agy1GzeL71Z8lrmQzk8QQuf/1kQzxsWVlzpKNXWS7u2CJ0sN5eINMngJBfv5ZFrZgfXc86wdgUKc8aaoX8OQA1kKTcdgbE9NcAhNr1+WfNxMnz84XzmUp2Y0H1jPgGkBKQJKArfQ==' })
50
+
51
+ expect(filtered_settings.my_secure_setting).to eql 'cJbFe0NI5wknmsp2fVgpC/YeBD2pvcdVD+p0pUdnMoYThaV4mpsspg/ZTBtmjx7kMwcF6cjXFLDVw3FxptTHwzJUd4akun6EZ57m+QzCMJYnfY95gB2/emEAQLSz4/YwsE4LDGydkEjY1ZprfXznf+rU31YGDJUTf34ESz7fsQGSc9DjkBb9ao8Mv4cI7pCXkQZDwS5kLAZDf6agy1GzeL71Z8lrmQzk8QQuf/1kQzxsWVlzpKNXWS7u2CJ0sN5eINMngJBfv5ZFrZgfXc86wdgUKc8aaoX8OQA1kKTcdgbE9NcAhNr1+WfNxMnz84XzmUp2Y0H1jPgGkBKQJKArfQ=='
52
+ end
46
53
  end
47
54
  end
48
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chamber
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - stevenhallen