cryptoform 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -1
- data/.tool-versions +1 -1
- data/Gemfile +2 -0
- data/Gemfile.lock +16 -5
- data/README.md +1 -1
- data/lib/cryptoform/config/builder.rb +6 -2
- data/lib/cryptoform/config/state_config_builder.rb +3 -1
- data/lib/cryptoform/encryption_backends/backend.rb +7 -2
- data/lib/cryptoform/encryption_backends/lockbox.rb +9 -3
- data/lib/cryptoform/server.rb +6 -2
- data/lib/cryptoform/storage_backends/backend.rb +7 -2
- data/lib/cryptoform/storage_backends/file.rb +6 -2
- data/lib/cryptoform/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0f9f5718fd04bc8d3b41709ab275e3c3149c687a05620d08befcfe6ab142465
|
4
|
+
data.tar.gz: e1007775f8a6ac33000f526f99f9704339e715c133b663a0c29ba00d625acfa3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24159b9944f41adae6d9a040531d6470dd5bac1a3de7d08e7d736ece145c7e4f827f3cb205bcc99179005b4cbf04ff21ab6556ee89ad043b5b99946ab5924853
|
7
|
+
data.tar.gz: 5bb71e41df20928ec480e2eb0c497646e7b43b7087a083900e0f2ddef3926237cc6f95aea6d4f9d04bd0b436309e7b6fe712423c8f1cb67817edbd10c513f8d1
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion: 3.
|
2
|
+
TargetRubyVersion: 3.2
|
3
3
|
NewCops: enable
|
4
4
|
SuggestExtensions: true
|
5
5
|
|
@@ -14,6 +14,11 @@ require:
|
|
14
14
|
- rubocop-performance
|
15
15
|
- rubocop-rspec
|
16
16
|
- rubocop-rake
|
17
|
+
- rubocop-disable_syntax
|
18
|
+
|
19
|
+
Style/DisableSyntax:
|
20
|
+
DisableSyntax:
|
21
|
+
- endless_methods
|
17
22
|
|
18
23
|
Layout/LineLength:
|
19
24
|
Max: 120
|
data/.tool-versions
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
ruby 3.
|
1
|
+
ruby 3.2.4
|
2
2
|
terraform 1.9.2
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cryptoform (0.
|
4
|
+
cryptoform (0.2.0)
|
5
5
|
async-http (~> 0.69)
|
6
6
|
base64 (~> 0.2)
|
7
7
|
lockbox (~> 1.3)
|
@@ -35,6 +35,7 @@ GEM
|
|
35
35
|
fiber-local (~> 1.1)
|
36
36
|
json
|
37
37
|
diff-lcs (1.5.1)
|
38
|
+
docile (1.4.0)
|
38
39
|
e2mmap (0.1.0)
|
39
40
|
fiber-annotation (0.2.0)
|
40
41
|
fiber-local (1.1.0)
|
@@ -63,7 +64,7 @@ GEM
|
|
63
64
|
iniparse (~> 1.4)
|
64
65
|
rexml (~> 3.2)
|
65
66
|
parallel (1.25.1)
|
66
|
-
parser (3.3.
|
67
|
+
parser (3.3.4.0)
|
67
68
|
ast (~> 2.4.1)
|
68
69
|
racc
|
69
70
|
protocol-hpack (1.4.3)
|
@@ -95,27 +96,35 @@ GEM
|
|
95
96
|
diff-lcs (>= 1.2.0, < 2.0)
|
96
97
|
rspec-support (~> 3.13.0)
|
97
98
|
rspec-support (3.13.1)
|
98
|
-
rubocop (1.
|
99
|
+
rubocop (1.65.0)
|
99
100
|
json (~> 2.3)
|
100
101
|
language_server-protocol (>= 3.17.0)
|
101
102
|
parallel (~> 1.10)
|
102
103
|
parser (>= 3.3.0.2)
|
103
104
|
rainbow (>= 2.2.2, < 4.0)
|
104
|
-
regexp_parser (>=
|
105
|
+
regexp_parser (>= 2.4, < 3.0)
|
105
106
|
rexml (>= 3.2.5, < 4.0)
|
106
107
|
rubocop-ast (>= 1.31.1, < 2.0)
|
107
108
|
ruby-progressbar (~> 1.7)
|
108
109
|
unicode-display_width (>= 2.4.0, < 3.0)
|
109
110
|
rubocop-ast (1.31.3)
|
110
111
|
parser (>= 3.3.1.0)
|
112
|
+
rubocop-disable_syntax (0.1.1)
|
113
|
+
rubocop (>= 1.50)
|
111
114
|
rubocop-performance (1.21.1)
|
112
115
|
rubocop (>= 1.48.1, < 2.0)
|
113
116
|
rubocop-ast (>= 1.31.1, < 2.0)
|
114
117
|
rubocop-rake (0.6.0)
|
115
118
|
rubocop (~> 1.0)
|
116
|
-
rubocop-rspec (3.0.
|
119
|
+
rubocop-rspec (3.0.3)
|
117
120
|
rubocop (~> 1.61)
|
118
121
|
ruby-progressbar (1.13.0)
|
122
|
+
simplecov (0.22.0)
|
123
|
+
docile (~> 1.1)
|
124
|
+
simplecov-html (~> 0.11)
|
125
|
+
simplecov_json_formatter (~> 0.1)
|
126
|
+
simplecov-html (0.12.3)
|
127
|
+
simplecov_json_formatter (0.1.4)
|
119
128
|
solargraph (0.50.0)
|
120
129
|
backport (~> 1.2)
|
121
130
|
benchmark
|
@@ -150,9 +159,11 @@ DEPENDENCIES
|
|
150
159
|
rake
|
151
160
|
rspec
|
152
161
|
rubocop
|
162
|
+
rubocop-disable_syntax
|
153
163
|
rubocop-performance
|
154
164
|
rubocop-rake
|
155
165
|
rubocop-rspec
|
166
|
+
simplecov
|
156
167
|
solargraph
|
157
168
|
|
158
169
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -8,7 +8,9 @@ class Cryptoform::Config::Builder
|
|
8
8
|
@states = {}
|
9
9
|
end
|
10
10
|
|
11
|
-
def port(port)
|
11
|
+
def port(port)
|
12
|
+
@port = port
|
13
|
+
end
|
12
14
|
|
13
15
|
def state(name, &)
|
14
16
|
name = name.to_sym
|
@@ -24,5 +26,7 @@ class Cryptoform::Config::Builder
|
|
24
26
|
raise Cryptoform::ConfigValidationError, "port must be an integer" if @key.is_a?(Numeric)
|
25
27
|
end
|
26
28
|
|
27
|
-
def config
|
29
|
+
def config
|
30
|
+
Config.new(@port, @states.transform_values(&:config))
|
31
|
+
end
|
28
32
|
end
|
@@ -31,7 +31,9 @@ class Cryptoform::Config::StateConfigBuilder
|
|
31
31
|
@encryption_backend = ENCRYPTION_BACKENDS[name].new(@name, **params)
|
32
32
|
end
|
33
33
|
|
34
|
-
def config
|
34
|
+
def config
|
35
|
+
Config.new(@storage_backend, @encryption_backend)
|
36
|
+
end
|
35
37
|
|
36
38
|
def validate!
|
37
39
|
if @storage_backend.nil?
|
@@ -6,6 +6,11 @@ class Cryptoform::EncryptionBackends::Backend
|
|
6
6
|
@params = params
|
7
7
|
end
|
8
8
|
|
9
|
-
def decrypt(ciphertext)
|
10
|
-
|
9
|
+
def decrypt(ciphertext)
|
10
|
+
raise NotImplementedError
|
11
|
+
end
|
12
|
+
|
13
|
+
def encrypt(json)
|
14
|
+
raise NotImplementedError
|
15
|
+
end
|
11
16
|
end
|
@@ -1,9 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Cryptoform::EncryptionBackends::Lockbox < Cryptoform::EncryptionBackends::Backend
|
4
|
-
def encrypt(json)
|
4
|
+
def encrypt(json)
|
5
|
+
lockbox.encrypt(json.to_json)
|
6
|
+
end
|
5
7
|
|
6
|
-
def decrypt(ciphertext)
|
8
|
+
def decrypt(ciphertext)
|
9
|
+
JSON.parse(lockbox.decrypt(ciphertext))
|
10
|
+
end
|
7
11
|
|
8
|
-
def lockbox
|
12
|
+
def lockbox
|
13
|
+
::Lockbox.new(key: @params[:key].call, encode: true)
|
14
|
+
end
|
9
15
|
end
|
data/lib/cryptoform/server.rb
CHANGED
@@ -40,9 +40,13 @@ class Cryptoform::Server
|
|
40
40
|
::Protocol::HTTP::Response[201, {}, []]
|
41
41
|
end
|
42
42
|
|
43
|
-
def logger
|
43
|
+
def logger
|
44
|
+
@logger ||= Logger.new($stdout)
|
45
|
+
end
|
44
46
|
|
45
|
-
def endpoint
|
47
|
+
def endpoint
|
48
|
+
@endpoint ||= Async::HTTP::Endpoint.parse("http://localhost:#{@config.port}")
|
49
|
+
end
|
46
50
|
|
47
51
|
def log_request(request)
|
48
52
|
yield.tap do |response|
|
@@ -6,6 +6,11 @@ class Cryptoform::StorageBackends::Backend
|
|
6
6
|
@params = params
|
7
7
|
end
|
8
8
|
|
9
|
-
def read
|
10
|
-
|
9
|
+
def read
|
10
|
+
raise NotImplementedError
|
11
|
+
end
|
12
|
+
|
13
|
+
def write(data)
|
14
|
+
raise NotImplementedError
|
15
|
+
end
|
11
16
|
end
|
@@ -7,9 +7,13 @@ class Cryptoform::StorageBackends::File < Cryptoform::StorageBackends::Backend
|
|
7
7
|
raise Cryptoform::StateMissingError, "state '#{@state_name}' is configured but missing"
|
8
8
|
end
|
9
9
|
|
10
|
-
def write(data)
|
10
|
+
def write(data)
|
11
|
+
::File.write(filename, data)
|
12
|
+
end
|
11
13
|
|
12
14
|
private
|
13
15
|
|
14
|
-
def filename
|
16
|
+
def filename
|
17
|
+
@filename ||= @params[:name] || "#{@state_name}.tfstate.enc"
|
18
|
+
end
|
15
19
|
end
|
data/lib/cryptoform/version.rb
CHANGED
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cryptoform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gleb Sinyavskiy
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
11
|
date: 2024-07-13 00:00:00.000000000 Z
|
@@ -105,9 +105,9 @@ licenses:
|
|
105
105
|
metadata:
|
106
106
|
homepage_uri: https://github.com/zhulik/cryptoform
|
107
107
|
source_code_uri: https://github.com/zhulik/cryptoform
|
108
|
-
changelog_uri: https://github.com/zhulik/cryptoform
|
108
|
+
changelog_uri: https://github.com/zhulik/cryptoform/releases
|
109
109
|
rubygems_mfa_required: 'true'
|
110
|
-
post_install_message:
|
110
|
+
post_install_message:
|
111
111
|
rdoc_options: []
|
112
112
|
require_paths:
|
113
113
|
- lib
|
@@ -115,15 +115,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
115
|
requirements:
|
116
116
|
- - ">="
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version: 3.
|
118
|
+
version: 3.2.0
|
119
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
121
|
- - ">="
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '0'
|
124
124
|
requirements: []
|
125
|
-
rubygems_version: 3.
|
126
|
-
signing_key:
|
125
|
+
rubygems_version: 3.5.11
|
126
|
+
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: Save your encypted terraform state in git.
|
129
129
|
test_files: []
|