rcredstash 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +28 -0
- data/Gemfile +4 -0
- data/README.md +5 -1
- data/lib/cred_stash/cipher_key.rb +2 -2
- data/lib/cred_stash/config.rb +3 -1
- data/lib/cred_stash/repository/dynamo_db.rb +1 -1
- data/lib/cred_stash/version.rb +1 -1
- data/rcredstash.gemspec +2 -2
- metadata +11 -11
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5b4072a6a3800e27a23712bb59ee8df5b4ec5be248acd94dbd0711fec3f4f54
|
4
|
+
data.tar.gz: 9d3eafb59ea8a166a66a4a79ccf6ed3c93ddfbe110b51ca5accb61d215a79070
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e011ab87a68a9022ebca726c4ee7316d2abaa39a5de721112f74199324b7fb4b5091393f70976c5947f9cf45581831bd2e5e9c035f614d838f71d793310f486
|
7
|
+
data.tar.gz: 5d19538fb21c39cdee4906cb447bb49846d3c7111d22afbe66d011846b688b8464c1d65ce1e0a214977f491e7c15d116098daf8a51da2b1ba4e8c5977449ff94
|
@@ -0,0 +1,28 @@
|
|
1
|
+
name: Ruby CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
|
13
|
+
strategy:
|
14
|
+
matrix:
|
15
|
+
# Currently supported Ruby versions as of 2024-04-03.
|
16
|
+
# See for current status: https://www.ruby-lang.org/en/downloads/branches/
|
17
|
+
ruby-version: ['3.3', '3.2', '3.1']
|
18
|
+
|
19
|
+
steps:
|
20
|
+
- uses: actions/checkout@v4
|
21
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
22
|
+
uses: ruby/setup-ruby@v1
|
23
|
+
with:
|
24
|
+
ruby-version: ${{ matrix.ruby-version }}
|
25
|
+
- name: Install dependencies
|
26
|
+
run: bundle install
|
27
|
+
- name: Run tests
|
28
|
+
run: AWS_REGION=us-east-1 bundle exec rake
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# RCredStash
|
1
|
+
# RCredStash ![Build Status](https://github.com/adorechic/rcredstash/actions/workflows/ruby.yml/badge.svg)
|
2
2
|
|
3
3
|
RCredStash is a ruby port of [CredStash](https://github.com/fugue/credstash)
|
4
4
|
|
@@ -56,6 +56,10 @@ RCredStash uses [aws-sdk v2](https://github.com/aws/aws-sdk-ruby), so configurat
|
|
56
56
|
```ruby
|
57
57
|
CredStash.configure do |config|
|
58
58
|
config.table_name = 'your_dynamodb_table_name'
|
59
|
+
|
60
|
+
# Optional, if you want to modify them, like for Localstack.
|
61
|
+
config.dynamo_client = Aws::DynamoDB::Client.new
|
62
|
+
config.kms_client = Aws::KMS::Client.new
|
59
63
|
end
|
60
64
|
```
|
61
65
|
|
@@ -5,7 +5,7 @@ class CredStash::CipherKey
|
|
5
5
|
|
6
6
|
attr_reader :data_key, :hmac_key, :wrapped_key
|
7
7
|
|
8
|
-
def self.generate(client:
|
8
|
+
def self.generate(client: CredStash.config.kms_client, kms_key_id: nil,
|
9
9
|
context: {})
|
10
10
|
res = client.generate_data_key(
|
11
11
|
key_id: kms_key_id || DEFAULT_KMS_KEY_ID,
|
@@ -19,7 +19,7 @@ class CredStash::CipherKey
|
|
19
19
|
)
|
20
20
|
end
|
21
21
|
|
22
|
-
def self.decrypt(wrapped_key, client:
|
22
|
+
def self.decrypt(wrapped_key, client: CredStash.config.kms_client, context: {})
|
23
23
|
res = client.decrypt(ciphertext_blob: wrapped_key, encryption_context: context)
|
24
24
|
new(
|
25
25
|
data_key: res.plaintext[0...32],
|
data/lib/cred_stash/config.rb
CHANGED
@@ -10,7 +10,7 @@ module CredStash
|
|
10
10
|
end
|
11
11
|
|
12
12
|
class Config
|
13
|
-
attr_accessor :table_name, :storage
|
13
|
+
attr_accessor :table_name, :storage, :kms_client, :dynamo_client
|
14
14
|
|
15
15
|
def initialize
|
16
16
|
reset!
|
@@ -19,6 +19,8 @@ module CredStash
|
|
19
19
|
def reset!
|
20
20
|
@table_name = 'credential-store'
|
21
21
|
@storage = :dynamodb
|
22
|
+
@kms_client = Aws::KMS::Client.new
|
23
|
+
@dynamo_client = Aws::DynamoDB::Client.new
|
22
24
|
end
|
23
25
|
end
|
24
26
|
end
|
data/lib/cred_stash/version.rb
CHANGED
data/rcredstash.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_dependency 'aws-sdk-dynamodb'
|
24
24
|
spec.add_dependency 'thor'
|
25
25
|
|
26
|
-
spec.add_development_dependency "bundler"
|
27
|
-
spec.add_development_dependency "rake"
|
26
|
+
spec.add_development_dependency "bundler"
|
27
|
+
spec.add_development_dependency "rake"
|
28
28
|
spec.add_development_dependency "rspec", "~> 3.0"
|
29
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rcredstash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- adorechic
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-kms
|
@@ -56,30 +56,30 @@ dependencies:
|
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,9 +102,9 @@ executables:
|
|
102
102
|
extensions: []
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
|
+
- ".github/workflows/ruby.yml"
|
105
106
|
- ".gitignore"
|
106
107
|
- ".rspec"
|
107
|
-
- ".travis.yml"
|
108
108
|
- Gemfile
|
109
109
|
- README.md
|
110
110
|
- Rakefile
|