chamber 2.10.1 → 2.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/lib/chamber/encryption_methods/none.rb +2 -0
  5. data/lib/chamber/version.rb +1 -1
  6. metadata +22 -99
  7. metadata.gz.sig +0 -0
  8. data/spec/fixtures/settings.yml +0 -28
  9. data/spec/lib/chamber/commands/files_spec.rb +0 -24
  10. data/spec/lib/chamber/commands/heroku/clear_spec.rb +0 -12
  11. data/spec/lib/chamber/commands/heroku/compare_spec.rb +0 -12
  12. data/spec/lib/chamber/commands/heroku/pull_spec.rb +0 -12
  13. data/spec/lib/chamber/commands/heroku/push_spec.rb +0 -12
  14. data/spec/lib/chamber/commands/secure_spec.rb +0 -42
  15. data/spec/lib/chamber/commands/show_spec.rb +0 -59
  16. data/spec/lib/chamber/context_resolver_spec.rb +0 -164
  17. data/spec/lib/chamber/file_set_spec.rb +0 -250
  18. data/spec/lib/chamber/file_spec.rb +0 -241
  19. data/spec/lib/chamber/filters/boolean_conversion_filter_spec.rb +0 -57
  20. data/spec/lib/chamber/filters/decryption_filter_spec.rb +0 -252
  21. data/spec/lib/chamber/filters/encryption_filter_spec.rb +0 -195
  22. data/spec/lib/chamber/filters/environment_filter_spec.rb +0 -48
  23. data/spec/lib/chamber/filters/failed_decryption_filter_spec.rb +0 -54
  24. data/spec/lib/chamber/filters/insecure_filter_spec.rb +0 -82
  25. data/spec/lib/chamber/filters/namespace_filter_spec.rb +0 -92
  26. data/spec/lib/chamber/filters/secure_filter_spec.rb +0 -41
  27. data/spec/lib/chamber/filters/translate_secure_keys_filter_spec.rb +0 -39
  28. data/spec/lib/chamber/namespace_set_spec.rb +0 -129
  29. data/spec/lib/chamber/settings_spec.rb +0 -390
  30. data/spec/lib/chamber/types/secured_spec.rb +0 -70
  31. data/spec/lib/chamber_spec.rb +0 -314
  32. data/spec/rails-2-test/config.ru +0 -0
  33. data/spec/rails-2-test/config/application.rb +0 -6
  34. data/spec/rails-2-test/script/console +0 -0
  35. data/spec/rails-3-test/config.ru +0 -0
  36. data/spec/rails-3-test/config/application.rb +0 -6
  37. data/spec/rails-3-test/script/rails +0 -0
  38. data/spec/rails-4-test/bin/rails +0 -0
  39. data/spec/rails-4-test/config.ru +0 -0
  40. data/spec/rails-4-test/config/application.rb +0 -6
  41. data/spec/rails-engine-test/spec/dummy/config.ru +0 -0
  42. data/spec/rails-engine-test/spec/dummy/config/application.rb +0 -5
  43. data/spec/rails-engine-test/spec/dummy/script/rails +0 -0
  44. data/spec/spec_key +0 -27
  45. data/spec/spec_key.pub +0 -9
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'rspectacular'
3
- require 'chamber/filters/environment_filter'
4
-
5
- module Chamber
6
- module Filters
7
- describe EnvironmentFilter do
8
- it 'can extract data from the environment if an existing variable matches the ' \
9
- 'composite key' do
10
-
11
- ENV['TEST_SETTING_GROUP_TEST_SETTING_LEVEL_TEST_SETTING'] = 'value 2'
12
-
13
- filtered_data = EnvironmentFilter.execute(data: {
14
- test_setting_group: {
15
- test_setting_level: {
16
- test_setting: 'value 1',
17
- },
18
- },
19
- })
20
-
21
- test_setting = filtered_data.test_setting_group.test_setting_level.test_setting
22
-
23
- expect(test_setting).to eql 'value 2'
24
-
25
- ENV.delete('TEST_SETTING_GROUP_TEST_SETTING_LEVEL_TEST_SETTING')
26
- end
27
-
28
- it 'does not affect items which are not stored in the environment' do
29
- ENV['TEST_SETTING_GROUP_TEST_SETTING_LEVEL_TEST_SETTING'] = 'value 2'
30
-
31
- filtered_data = EnvironmentFilter.execute(data: {
32
- test_setting_group: {
33
- test_setting_level: {
34
- test_setting: 'value 1',
35
- another_setting: 'value 3',
36
- },
37
- },
38
- })
39
-
40
- another_setting = filtered_data.test_setting_group.test_setting_level.another_setting
41
-
42
- expect(another_setting).to eql 'value 3'
43
-
44
- ENV.delete('TEST_SETTING_GROUP_TEST_SETTING_LEVEL_TEST_SETTING')
45
- end
46
- end
47
- end
48
- end
@@ -1,54 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'rspectacular'
3
- require 'chamber/filters/failed_decryption_filter'
4
-
5
- module Chamber
6
- module Filters
7
- describe FailedDecryptionFilter do
8
- it 'raises an exception if any of the settings are not decrypted' do
9
- expect {
10
- FailedDecryptionFilter.execute(
11
- data: {
12
- _secure_my_secure_setting: 'cJbFe0NI5wknmsp2fVgpC/YeBD2pvcdVD+p0pUdnMoYThaV4m' \
13
- 'psspg/ZTBtmjx7kMwcF6cjXFLDVw3FxptTHwzJUd4akun6EZ5' \
14
- '7m+QzCMJYnfY95gB2/emEAQLSz4/YwsE4LDGydkEjY1ZprfXz' \
15
- 'nf+rU31YGDJUTf34ESz7fsQGSc9DjkBb9ao8Mv4cI7pCXkQZD' \
16
- 'wS5kLAZDf6agy1GzeL71Z8lrmQzk8QQuf/1kQzxsWVlzpKNXW' \
17
- 'S7u2CJ0sN5eINMngJBfv5ZFrZgfXc86wdgUKc8aaoX8OQA1kK' \
18
- 'TcdgbE9NcAhNr1+WfNxMnz84XzmUp2Y0H1jPgGkBKQJKArfQ==',
19
- },
20
- )
21
- }.
22
- to raise_error Chamber::Errors::DecryptionFailure
23
- end
24
-
25
- it 'does not raise an exception if it is not a secure key' do
26
- expect {
27
- FailedDecryptionFilter.execute(
28
- data: {
29
- my_secure_setting: 'cJbFe0NI5wknmsp2fVgpC/YeBD2pvcdVD+p0pUdnMoYThaV4m' \
30
- 'psspg/ZTBtmjx7kMwcF6cjXFLDVw3FxptTHwzJUd4akun6EZ5' \
31
- '7m+QzCMJYnfY95gB2/emEAQLSz4/YwsE4LDGydkEjY1ZprfXz' \
32
- 'nf+rU31YGDJUTf34ESz7fsQGSc9DjkBb9ao8Mv4cI7pCXkQZD' \
33
- 'wS5kLAZDf6agy1GzeL71Z8lrmQzk8QQuf/1kQzxsWVlzpKNXW' \
34
- 'S7u2CJ0sN5eINMngJBfv5ZFrZgfXc86wdgUKc8aaoX8OQA1kK' \
35
- 'TcdgbE9NcAhNr1+WfNxMnz84XzmUp2Y0H1jPgGkBKQJKArfQ==',
36
- },
37
- )
38
- }.
39
- not_to raise_error
40
- end
41
-
42
- it 'does not raise an exception if it is not a secure value' do
43
- expect {
44
- FailedDecryptionFilter.execute(
45
- data: {
46
- _secure_my_secure_setting: 'hello',
47
- },
48
- )
49
- }.
50
- not_to raise_error
51
- end
52
- end
53
- end
54
- end
@@ -1,82 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'rspectacular'
3
- require 'chamber/filters/insecure_filter'
4
-
5
- module Chamber
6
- module Filters
7
- describe InsecureFilter do
8
- it 'will return values which are marked as "secure" if they are unencrypted' do
9
- filtered_settings = InsecureFilter.execute(data: {
10
- _secure_my_secure_setting: 'hello',
11
- })
12
-
13
- expect(filtered_settings._secure_my_secure_setting).to match 'hello'
14
- end
15
-
16
- it 'will not return values which are not marked as "secure"' do
17
- filtered_settings = InsecureFilter.execute(data: {
18
- my_secure_setting: 'hello',
19
- })
20
-
21
- expect(filtered_settings.my_secure_setting).to be_nil
22
- end
23
-
24
- it 'will properly return values even if they are mixed and deeply nested' do
25
- filtered_settings = InsecureFilter.execute(data: {
26
- _secure_setting: 'hello',
27
- secure_setting: 'goodbye',
28
- secure_group: {
29
- _secure_nested_setting: 'movie',
30
- insecure_nested_setting: 'dinner',
31
- },
32
- })
33
-
34
- expect(filtered_settings._secure_setting).to eql 'hello'
35
- expect(filtered_settings.secure_setting).to be_nil
36
- expect(filtered_settings.secure_group._secure_nested_setting).to eql 'movie'
37
- expect(filtered_settings.secure_group.insecure_nested_setting).to be_nil
38
- end
39
-
40
- it 'will not return values which are encrypted' do
41
- filtered_settings = InsecureFilter.execute(
42
- data: {
43
- _secure_setting: 'cJbFe0NI5wknmsp2fVgpC/YeBD2pvcdVD+p0pUdnMoYThaV4mpss' \
44
- 'pg/ZTBtmjx7kMwcF6cjXFLDVw3FxptTHwzJUd4akun6EZ57m+QzC' \
45
- 'MJYnfY95gB2/emEAQLSz4/YwsE4LDGydkEjY1ZprfXznf+rU31YG' \
46
- 'DJUTf34ESz7fsQGSc9DjkBb9ao8Mv4cI7pCXkQZDwS5kLAZDf6ag' \
47
- 'y1GzeL71Z8lrmQzk8QQuf/1kQzxsWVlzpKNXWS7u2CJ0sN5eINMn' \
48
- 'gJBfv5ZFrZgfXc86wdgUKc8aaoX8OQA1kKTcdgbE9NcAhNr1+WfN' \
49
- 'xMnz84XzmUp2Y0H1jPgGkBKQJKArfQ==',
50
- secure_setting: 'cJbFe0NI5wknmsp2fVgpC/YeBD2pvcdVD+p0pUdnMoYThaV4mpss' \
51
- 'pg/ZTBtmjx7kMwcF6cjXFLDVw3FxptTHwzJUd4akun6EZ57m+QzC' \
52
- 'MJYnfY95gB2/emEAQLSz4/YwsE4LDGydkEjY1ZprfXznf+rU31YG' \
53
- 'DJUTf34ESz7fsQGSc9DjkBb9ao8Mv4cI7pCXkQZDwS5kLAZDf6ag' \
54
- 'y1GzeL71Z8lrmQzk8QQuf/1kQzxsWVlzpKNXWS7u2CJ0sN5eINMn' \
55
- 'gJBfv5ZFrZgfXc86wdgUKc8aaoX8OQA1kKTcdgbE9NcAhNr1+WfN' \
56
- 'xMnz84XzmUp2Y0H1jPgGkBKQJKArfQ==',
57
- _secure_other_setting: 'hello',
58
- secure_group: {
59
- _secure_nested_setting: 'cJbFe0NI5wknmsp2fVgpC/YeBD2pvcdVD+p0pUdnMoYTh' \
60
- 'aV4mpsspg/ZTBtmjx7kMwcF6cjXFLDVw3FxptTHwzJUd4' \
61
- 'akun6EZ57m+QzCMJYnfY95gB2/emEAQLSz4/YwsE4LDGy' \
62
- 'dkEjY1ZprfXznf+rU31YGDJUTf34ESz7fsQGSc9DjkBb9' \
63
- 'ao8Mv4cI7pCXkQZDwS5kLAZDf6agy1GzeL71Z8lrmQzk8' \
64
- 'QQuf/1kQzxsWVlzpKNXWS7u2CJ0sN5eINMngJBfv5ZFrZ' \
65
- 'gfXc86wdgUKc8aaoX8OQA1kKTcdgbE9NcAhNr1+WfNxMn' \
66
- 'z84XzmUp2Y0H1jPgGkBKQJKArfQ==',
67
- _secure_other_nested_setting: 'goodbye',
68
- insecure_nested_setting: 'dinner',
69
- },
70
- },
71
- )
72
-
73
- expect(filtered_settings._secure_setting?).to eql false
74
- expect(filtered_settings.secure_setting?).to eql false
75
- expect(filtered_settings._secure_other_setting).to eql 'hello'
76
- expect(filtered_settings.secure_group._secure_nested_setting?).to eql false
77
- expect(filtered_settings.secure_group._secure_other_nested_setting).to eql 'goodbye'
78
- expect(filtered_settings.secure_group.insecure_nested_setting?).to eql false
79
- end
80
- end
81
- end
82
- end
@@ -1,92 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'rspectacular'
3
- require 'chamber/filters/namespace_filter'
4
- require 'chamber/namespace_set'
5
-
6
- module Chamber
7
- module Filters
8
- describe NamespaceFilter do
9
- it 'can filter settings data based on the settings namespaces' do
10
- filtered_settings = NamespaceFilter.execute(
11
- data: {
12
- namespace_value: {
13
- namespace_setting: 'value 1',
14
- },
15
- other_namespace_value: {
16
- other_namespace_setting: 'value 2',
17
- },
18
- },
19
- namespaces: %w{namespace_value other_namespace_value},
20
- )
21
-
22
- expect(filtered_settings.namespace_setting).to eql 'value 1'
23
- expect(filtered_settings.other_namespace_setting).to eql 'value 2'
24
- end
25
-
26
- it 'ignores data which is not part of a namespace' do
27
- filtered_settings = NamespaceFilter.execute(
28
- data: {
29
- namespace_value: {
30
- namespace_setting: 'value 1',
31
- },
32
- non_namespaced_value: {
33
- non_namespaced_setting: 'value 2',
34
- },
35
- },
36
- namespaces: [
37
- 'namespace_value',
38
- ],
39
- )
40
-
41
- expect(filtered_settings.namespace_setting).to eql 'value 1'
42
- expect(filtered_settings.non_namespaced_setting).to be_nil
43
- end
44
-
45
- it 'ignores namespaces which do not exist in the data' do
46
- filtered_settings = NamespaceFilter.execute(
47
- data: {
48
- namespace_value: {
49
- namespace_setting: 'value 1',
50
- },
51
- },
52
- namespaces: %w{namespace_value other_namespace_value},
53
- )
54
-
55
- expect(filtered_settings.namespace_setting).to eql 'value 1'
56
- end
57
-
58
- it 'does not filter data if it does not include any namespaces' do
59
- filtered_settings = NamespaceFilter.execute(
60
- data: {
61
- non_namespaced_setting: 'value 1',
62
- },
63
- namespaces: [],
64
- )
65
-
66
- expect(filtered_settings.non_namespaced_setting).to eql 'value 1'
67
- end
68
-
69
- it 'can filter if it is given NamespaceSets' do
70
- filtered_settings = NamespaceFilter.execute(
71
- data: {
72
- namespace_value: {
73
- namespace_setting: 'value 1',
74
- another_namespace_setting: 'value 2',
75
- },
76
- other_namespace_value: {
77
- namespace_setting_1: 'value 1',
78
- another_namespace_setting_2: 'value 2',
79
- },
80
- non_namespaced_value: 'value 3',
81
- },
82
- namespaces: NamespaceSet.new(%w{namespace_value other_namespace_value}),
83
- )
84
-
85
- expect(filtered_settings.to_hash).to eql('namespace_setting' => 'value 1',
86
- 'another_namespace_setting' => 'value 2',
87
- 'namespace_setting_1' => 'value 1',
88
- 'another_namespace_setting_2' => 'value 2')
89
- end
90
- end
91
- end
92
- end
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'rspectacular'
3
- require 'chamber/filters/secure_filter'
4
-
5
- module Chamber
6
- module Filters
7
- describe SecureFilter do
8
- it 'will return values which are marked as "secure"' do
9
- filtered_settings = SecureFilter.execute(data: {
10
- _secure_my_secure_setting: 'hello',
11
- })
12
-
13
- expect(filtered_settings._secure_my_secure_setting).to match 'hello'
14
- end
15
-
16
- it 'will not return values which are not marked as "secure"' do
17
- filtered_settings = SecureFilter.execute(data: {
18
- my_secure_setting: 'hello',
19
- })
20
-
21
- expect(filtered_settings.my_secure_setting).to be_nil
22
- end
23
-
24
- it 'will properly return values even if they are mixed and deeply nested' do
25
- filtered_settings = SecureFilter.execute(data: {
26
- _secure_setting: 'hello',
27
- secure_setting: 'goodbye',
28
- secure_group: {
29
- _secure_nested_setting: 'movie',
30
- insecure_nested_setting: 'dinner',
31
- },
32
- })
33
-
34
- expect(filtered_settings._secure_setting).to eql 'hello'
35
- expect(filtered_settings.secure_setting).to be_nil
36
- expect(filtered_settings.secure_group._secure_nested_setting).to eql 'movie'
37
- expect(filtered_settings.secure_group.insecure_nested_setting).to be_nil
38
- end
39
- end
40
- end
41
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'rspectacular'
3
- require 'chamber/filters/translate_secure_keys_filter'
4
-
5
- module Chamber
6
- module Filters
7
- describe TranslateSecureKeysFilter do
8
- it 'will translate keys if they start with "_secure_"' do
9
- filtered_settings = TranslateSecureKeysFilter.execute(
10
- data: {
11
- _secure_my_secure_setting: 'hello',
12
- },
13
- )
14
-
15
- expect(filtered_settings.my_secure_setting).to eql 'hello'
16
- end
17
-
18
- it 'will not translate keys if they do not start with "_secure_"' do
19
- filtered_settings = TranslateSecureKeysFilter.execute(
20
- data: {
21
- my_secure_setting: 'hello',
22
- },
23
- )
24
-
25
- expect(filtered_settings.my_secure_setting).to eql 'hello'
26
- end
27
-
28
- it 'will not translate the key if it starts with "secure"' do
29
- filtered_settings = TranslateSecureKeysFilter.execute(
30
- data: {
31
- secure_setting: 'hello',
32
- },
33
- )
34
-
35
- expect(filtered_settings.secure_setting).to eql 'hello'
36
- end
37
- end
38
- end
39
- end
@@ -1,129 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'rspectacular'
3
- require 'chamber/namespace_set'
4
-
5
- module Chamber
6
- describe NamespaceSet do
7
- it 'can create a set from from a hash' do
8
- namespace_set = NamespaceSet.new(environment: :development,
9
- hostname: 'my host')
10
-
11
- expect(namespace_set).to eq ['development', 'my host']
12
- end
13
-
14
- it 'can create a set from an array' do
15
- namespace_set = NamespaceSet.new([
16
- :development,
17
- 'my host',
18
- ])
19
-
20
- expect(namespace_set).to eq ['development', 'my host']
21
- end
22
-
23
- it 'can create a set from a set' do
24
- original_set = Set[:development, 'my host']
25
- namespace_set = NamespaceSet.new(original_set)
26
-
27
- expect(namespace_set).to eq ['development', 'my host']
28
- end
29
-
30
- it 'can create itself using square-bracket notation' do
31
- namespace_set = NamespaceSet[:development, 'my host']
32
-
33
- expect(namespace_set).to eq ['development', 'my host']
34
- end
35
-
36
- it 'can create itself from another NamespaceSet' do
37
- original_set = NamespaceSet[:development, 'my host']
38
- namespace_set = NamespaceSet.new(original_set)
39
-
40
- expect(namespace_set).to eq ['development', 'my host']
41
- end
42
-
43
- it 'can create itself from a single value' do
44
- namespace_set = NamespaceSet.new(:development)
45
-
46
- expect(namespace_set).to eq ['development']
47
- end
48
-
49
- it 'when creating itself from another NamespaceSet, it creates a new NamespaceSet' do
50
- original_set = NamespaceSet[:development, 'my host']
51
- namespace_set = NamespaceSet.new(original_set)
52
-
53
- expect(namespace_set.object_id).not_to eq original_set.object_id
54
- end
55
-
56
- it 'when creating itself from another NamespaceSet, it does not nest the ' \
57
- 'NamespaceSets' do
58
-
59
- original_set = NamespaceSet[:development, 'my host']
60
- namespace_set = NamespaceSet.new(original_set)
61
-
62
- expect(namespace_set.__send__(:raw_namespaces)).not_to be_a NamespaceSet
63
- end
64
-
65
- it 'can turn itself into an array' do
66
- namespace_set = NamespaceSet[:development, 'my host']
67
-
68
- expect(namespace_set.to_ary).to eq ['development', 'my host']
69
- expect(namespace_set.to_a).to eq ['development', 'my host']
70
- end
71
-
72
- it 'can combine itself with an array' do
73
- namespace_set = NamespaceSet[:development, 'my host']
74
- other_set = Set['other value', 3]
75
-
76
- combined_set = namespace_set + other_set
77
-
78
- expect(combined_set).to eq ['development', 'my host', 'other value', '3']
79
- end
80
-
81
- it 'can combine itself with another NamespaceSet' do
82
- namespace_set = NamespaceSet[:development, 'my host']
83
- other_set = NamespaceSet['other value', 3]
84
-
85
- combined_set = namespace_set + other_set
86
-
87
- expect(combined_set).to eq ['development', 'my host', 'other value', '3']
88
- end
89
-
90
- it 'does not modify the set in place if combining with another array' do
91
- namespace_set = NamespaceSet[:development, 'my host']
92
- other_set = Set['other value', 3]
93
- combined_set = namespace_set + other_set
94
-
95
- expect(combined_set.object_id).not_to eq namespace_set.object_id
96
- end
97
-
98
- it 'can combine itself with something that can be converted to an array' do
99
- namespace_set = NamespaceSet[:development, 'my host']
100
- other_set = (1..3)
101
- combined_set = namespace_set + other_set
102
-
103
- expect(combined_set).to eq ['development', 'my host', '1', '2', '3']
104
- end
105
-
106
- it 'does not allow duplicate items' do
107
- namespace_set = NamespaceSet[:development, :development]
108
-
109
- expect(namespace_set).to eq ['development']
110
- end
111
-
112
- it 'will process a value by executing it if it is a callable' do
113
- namespace_set = NamespaceSet[-> { 'callable' }]
114
-
115
- expect(namespace_set).to eq ['callable']
116
-
117
- namespace_set = NamespaceSet.new(my_namespace: -> { 'callable' })
118
-
119
- expect(namespace_set).to eq ['callable']
120
- end
121
-
122
- it 'can compare itself to another NamespaceSet' do
123
- namespace_set = NamespaceSet[:development, :development]
124
- other_namespace_set = NamespaceSet[:development, :development]
125
-
126
- expect(namespace_set).to eql other_namespace_set
127
- end
128
- end
129
- end