kumo_ki 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.buildkite/pipeline.yml +5 -0
- data/kumo_ki.gemspec +2 -0
- data/lib/kumo_ki/errors.rb +4 -0
- data/lib/kumo_ki/version.rb +1 -1
- data/lib/kumo_ki.rb +3 -0
- data/script/unit_test.sh +13 -0
- data/script/upload_buildkite_pipeline.sh +2 -0
- data/spec/kumo_ki_spec.rb +31 -0
- data/spec/spec_helper.rb +2 -0
- metadata +39 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c07fde0967bcc0d743dcd5f251ad012bb69fe05e
|
4
|
+
data.tar.gz: 935751b0a6be3f3d32b6bf91c82bd71f33bf1a27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c6b629d2bb34041d9e86cfc772bbcbede7383bd67aa4512dd71aadc8987c41b71f3aa046861884df2fc525999e67eaf4c751f22f2db1806d07a0d8b4d3fa0ea
|
7
|
+
data.tar.gz: 1ea2d1b2fa36cf3ec96cf934a3a5b8083d91230c5777b04436cfc90f214042c8b022ce7dc1970b55ca36fbbb1aed3357c0fb41c1c255c9ecd85ba7b0e5ed37e0
|
data/kumo_ki.gemspec
CHANGED
@@ -20,6 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.6'
|
22
22
|
spec.add_development_dependency 'rake', '~> 10.0'
|
23
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
24
|
+
spec.add_development_dependency 'rubocop', '~> 0.40'
|
23
25
|
|
24
26
|
spec.add_runtime_dependency 'aws-sdk', '~> 2'
|
25
27
|
end
|
data/lib/kumo_ki/version.rb
CHANGED
data/lib/kumo_ki.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'kumo_ki/version'
|
2
|
+
require 'kumo_ki/errors'
|
2
3
|
require 'aws-sdk'
|
3
4
|
require 'base64'
|
4
5
|
|
@@ -14,6 +15,8 @@ module KumoKi
|
|
14
15
|
client.decrypt({
|
15
16
|
ciphertext_blob: Base64.decode64(cipher_text)
|
16
17
|
}).plaintext
|
18
|
+
rescue => e
|
19
|
+
raise KumoKi::DecryptionError.new("There was a problem decrypting your secrets: #{e.message}")
|
17
20
|
end
|
18
21
|
|
19
22
|
def encrypt_for(env_name, plain_text)
|
data/script/unit_test.sh
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
echo "--- :clock1: :clock2: running specs :clock3: :clock4:"
|
6
|
+
bundle install && bundle exec rspec
|
7
|
+
|
8
|
+
function inline_image {
|
9
|
+
printf '\033]1338;url='"$1"';alt='"$2"'\a\n'
|
10
|
+
}
|
11
|
+
|
12
|
+
echo "+++ Done! :thumbsup: :shipit:"
|
13
|
+
inline_image "https://giftoppr.desktopprassets.com/uploads/f828c372186b5fa80a1c553adbcd4bc4d331396b/tumblr_m2cg550aq21ql201ao1_500.gif" "Yuss"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe KumoKi::KMS do
|
4
|
+
describe '#decrypt' do
|
5
|
+
subject { KumoKi::KMS.new.decrypt("a thing")}
|
6
|
+
let(:kms) { instance_double(Aws::KMS::Client) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
allow(Aws::KMS::Client).to receive(:new).and_return(kms)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'can decrypt' do
|
13
|
+
plaintext = 'beowulf'
|
14
|
+
decrypted_object = double('KMS decrypted result', plaintext: plaintext)
|
15
|
+
allow(kms).to receive(:decrypt).and_return decrypted_object
|
16
|
+
|
17
|
+
expect(subject).to eq plaintext
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'something goes wrong' do
|
21
|
+
let(:nested_error_message) { 'Liar liar pants on fire' }
|
22
|
+
|
23
|
+
it 'blows up if it cannot decrypt' do
|
24
|
+
allow(kms).to receive(:decrypt).and_raise(RuntimeError, nested_error_message)
|
25
|
+
|
26
|
+
expect { subject }.to raise_error(KumoKi::DecryptionError, "There was a problem decrypting your secrets: #{nested_error_message}")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kumo_ki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Redbubble Delivery Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,34 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.40'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.40'
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
70
|
name: aws-sdk
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,6 +87,7 @@ executables: []
|
|
59
87
|
extensions: []
|
60
88
|
extra_rdoc_files: []
|
61
89
|
files:
|
90
|
+
- ".buildkite/pipeline.yml"
|
62
91
|
- ".gitignore"
|
63
92
|
- Gemfile
|
64
93
|
- LICENSE.txt
|
@@ -66,7 +95,12 @@ files:
|
|
66
95
|
- Rakefile
|
67
96
|
- kumo_ki.gemspec
|
68
97
|
- lib/kumo_ki.rb
|
98
|
+
- lib/kumo_ki/errors.rb
|
69
99
|
- lib/kumo_ki/version.rb
|
100
|
+
- script/unit_test.sh
|
101
|
+
- script/upload_buildkite_pipeline.sh
|
102
|
+
- spec/kumo_ki_spec.rb
|
103
|
+
- spec/spec_helper.rb
|
70
104
|
homepage: https://github.com/redbubble
|
71
105
|
licenses:
|
72
106
|
- MIT
|
@@ -91,4 +125,6 @@ rubygems_version: 2.2.2
|
|
91
125
|
signing_key:
|
92
126
|
specification_version: 4
|
93
127
|
summary: Gem for accessing secrets in Amazon's Key Management Service
|
94
|
-
test_files:
|
128
|
+
test_files:
|
129
|
+
- spec/kumo_ki_spec.rb
|
130
|
+
- spec/spec_helper.rb
|