daffy_lib 0.1.1 → 0.1.7
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.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -1
- data/.rubocop.yml +136 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +134 -128
- data/LICENSE +201 -0
- data/README.md +32 -35
- data/daffy_lib.gemspec +4 -2
- data/lib/daffy_lib/concerns/has_guid.rb +2 -2
- data/lib/daffy_lib/services/key_management_service.rb +1 -1
- data/lib/daffy_lib/validators/string_validator.rb +2 -2
- data/lib/daffy_lib/version.rb +1 -1
- data/lib/tasks/db_tasks.rake +46 -0
- metadata +12 -12
- data/daffy_lib-0.1.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55642019a54722a3529693a7a6fbb5bba244fba4333e4ff3bdb18e7f95bd9358
|
4
|
+
data.tar.gz: 5e12a14929c8abe9bcde5aea42fdd625d57a1e8c8726fb995369681cd5be229a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19cf9991a36006605ae1d55b31494030702f68332a6e84f5f8e3f5a3df735ee023a2b52b8e3c7d50c26f71da4e0fd147245122fd99a8cc433678322c59b4976a
|
7
|
+
data.tar.gz: 3551ee4918d4274e7193f5c8e644fe69e9a7cff1254e5bd39848b642b8bb5df95dbc2068a7c92702a348af32e91173b70bee8f45abc11237b3900d237da90b34
|
data/.circleci/config.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -9,7 +9,7 @@ AllCops:
|
|
9
9
|
- node_modules/**/*
|
10
10
|
- output/**/*
|
11
11
|
- vendor/**/*
|
12
|
-
TargetRubyVersion: 2.
|
12
|
+
TargetRubyVersion: 2.7.1
|
13
13
|
RSpec:
|
14
14
|
Patterns:
|
15
15
|
- _spec.rb
|
@@ -58,3 +58,138 @@ RSpec/MultipleExpectations:
|
|
58
58
|
|
59
59
|
RSpec/ExampleLength:
|
60
60
|
Max: 10
|
61
|
+
|
62
|
+
Style/HashEachMethods:
|
63
|
+
Enabled: true
|
64
|
+
|
65
|
+
Style/HashTransformKeys:
|
66
|
+
Enabled: true
|
67
|
+
|
68
|
+
Style/HashTransformValues:
|
69
|
+
Enabled: true
|
70
|
+
|
71
|
+
Lint/RaiseException:
|
72
|
+
Enabled: true
|
73
|
+
|
74
|
+
Lint/StructNewOverride:
|
75
|
+
Enabled: true
|
76
|
+
|
77
|
+
Layout/SpaceAroundMethodCallOperator:
|
78
|
+
Enabled: true
|
79
|
+
|
80
|
+
Style/ExponentialNotation:
|
81
|
+
Enabled: true
|
82
|
+
|
83
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
84
|
+
Enabled: true
|
85
|
+
|
86
|
+
Lint/DeprecatedOpenSSLConstant:
|
87
|
+
Enabled: true
|
88
|
+
|
89
|
+
Style/SlicingWithRange:
|
90
|
+
Enabled: true
|
91
|
+
|
92
|
+
Lint/MixedRegexpCaptureTypes:
|
93
|
+
Enabled: true
|
94
|
+
|
95
|
+
Style/RedundantRegexpCharacterClass:
|
96
|
+
Enabled: true
|
97
|
+
|
98
|
+
Style/RedundantRegexpEscape:
|
99
|
+
Enabled: true
|
100
|
+
|
101
|
+
Style/RedundantFetchBlock:
|
102
|
+
Enabled: true
|
103
|
+
|
104
|
+
Style/AccessorGrouping:
|
105
|
+
Enabled: true
|
106
|
+
|
107
|
+
Style/BisectedAttrAccessor:
|
108
|
+
Enabled: true
|
109
|
+
|
110
|
+
Style/RedundantAssignment:
|
111
|
+
Enabled: true
|
112
|
+
|
113
|
+
Performance/AncestorsInclude:
|
114
|
+
Enabled: true
|
115
|
+
|
116
|
+
Performance/BigDecimalWithNumericArgument:
|
117
|
+
Enabled: true
|
118
|
+
|
119
|
+
Performance/RedundantSortBlock:
|
120
|
+
Enabled: true
|
121
|
+
|
122
|
+
Performance/RedundantStringChars:
|
123
|
+
Enabled: true
|
124
|
+
|
125
|
+
Performance/ReverseFirst:
|
126
|
+
Enabled: true
|
127
|
+
|
128
|
+
Performance/SortReverse:
|
129
|
+
Enabled: true
|
130
|
+
|
131
|
+
Performance/Squeeze:
|
132
|
+
Enabled: true
|
133
|
+
|
134
|
+
Performance/StringInclude:
|
135
|
+
Enabled: true
|
136
|
+
|
137
|
+
Lint/DuplicateElsifCondition:
|
138
|
+
Enabled: true
|
139
|
+
|
140
|
+
Style/ArrayCoercion:
|
141
|
+
Enabled: true
|
142
|
+
|
143
|
+
Style/CaseLikeIf:
|
144
|
+
Enabled: true
|
145
|
+
|
146
|
+
Style/HashAsLastArrayItem:
|
147
|
+
Enabled: true
|
148
|
+
|
149
|
+
Style/HashLikeCase:
|
150
|
+
Enabled: true
|
151
|
+
|
152
|
+
Style/RedundantFileExtensionInRequire:
|
153
|
+
Enabled: true
|
154
|
+
|
155
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
156
|
+
Enabled: true
|
157
|
+
|
158
|
+
Lint/DuplicateRescueException:
|
159
|
+
Enabled: true
|
160
|
+
|
161
|
+
Lint/EmptyConditionalBody:
|
162
|
+
Enabled: true
|
163
|
+
|
164
|
+
Lint/FloatComparison:
|
165
|
+
Enabled: true
|
166
|
+
|
167
|
+
Lint/MissingSuper:
|
168
|
+
Enabled: true
|
169
|
+
|
170
|
+
Lint/OutOfRangeRegexpRef:
|
171
|
+
Enabled: true
|
172
|
+
|
173
|
+
Lint/SelfAssignment:
|
174
|
+
Enabled: true
|
175
|
+
|
176
|
+
Lint/TopLevelReturnWithArgument:
|
177
|
+
Enabled: true
|
178
|
+
|
179
|
+
Lint/UnreachableLoop:
|
180
|
+
Enabled: true
|
181
|
+
|
182
|
+
Style/ExplicitBlockArgument:
|
183
|
+
Enabled: true
|
184
|
+
|
185
|
+
Style/GlobalStdStream:
|
186
|
+
Enabled: true
|
187
|
+
|
188
|
+
Style/OptionalBooleanParameter:
|
189
|
+
Enabled: true
|
190
|
+
|
191
|
+
Style/SingleArgumentDig:
|
192
|
+
Enabled: true
|
193
|
+
|
194
|
+
Style/StringConcatenation:
|
195
|
+
Enabled: true
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
daffy_lib (0.1.
|
4
|
+
daffy_lib (0.1.7)
|
5
5
|
porky_lib
|
6
6
|
rails
|
7
7
|
redis
|
@@ -9,158 +9,160 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
actioncable (6.0.
|
13
|
-
actionpack (= 6.0.
|
12
|
+
actioncable (6.0.3.4)
|
13
|
+
actionpack (= 6.0.3.4)
|
14
14
|
nio4r (~> 2.0)
|
15
15
|
websocket-driver (>= 0.6.1)
|
16
|
-
actionmailbox (6.0.
|
17
|
-
actionpack (= 6.0.
|
18
|
-
activejob (= 6.0.
|
19
|
-
activerecord (= 6.0.
|
20
|
-
activestorage (= 6.0.
|
21
|
-
activesupport (= 6.0.
|
16
|
+
actionmailbox (6.0.3.4)
|
17
|
+
actionpack (= 6.0.3.4)
|
18
|
+
activejob (= 6.0.3.4)
|
19
|
+
activerecord (= 6.0.3.4)
|
20
|
+
activestorage (= 6.0.3.4)
|
21
|
+
activesupport (= 6.0.3.4)
|
22
22
|
mail (>= 2.7.1)
|
23
|
-
actionmailer (6.0.
|
24
|
-
actionpack (= 6.0.
|
25
|
-
actionview (= 6.0.
|
26
|
-
activejob (= 6.0.
|
23
|
+
actionmailer (6.0.3.4)
|
24
|
+
actionpack (= 6.0.3.4)
|
25
|
+
actionview (= 6.0.3.4)
|
26
|
+
activejob (= 6.0.3.4)
|
27
27
|
mail (~> 2.5, >= 2.5.4)
|
28
28
|
rails-dom-testing (~> 2.0)
|
29
|
-
actionpack (6.0.
|
30
|
-
actionview (= 6.0.
|
31
|
-
activesupport (= 6.0.
|
29
|
+
actionpack (6.0.3.4)
|
30
|
+
actionview (= 6.0.3.4)
|
31
|
+
activesupport (= 6.0.3.4)
|
32
32
|
rack (~> 2.0, >= 2.0.8)
|
33
33
|
rack-test (>= 0.6.3)
|
34
34
|
rails-dom-testing (~> 2.0)
|
35
35
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
36
|
-
actiontext (6.0.
|
37
|
-
actionpack (= 6.0.
|
38
|
-
activerecord (= 6.0.
|
39
|
-
activestorage (= 6.0.
|
40
|
-
activesupport (= 6.0.
|
36
|
+
actiontext (6.0.3.4)
|
37
|
+
actionpack (= 6.0.3.4)
|
38
|
+
activerecord (= 6.0.3.4)
|
39
|
+
activestorage (= 6.0.3.4)
|
40
|
+
activesupport (= 6.0.3.4)
|
41
41
|
nokogiri (>= 1.8.5)
|
42
|
-
actionview (6.0.
|
43
|
-
activesupport (= 6.0.
|
42
|
+
actionview (6.0.3.4)
|
43
|
+
activesupport (= 6.0.3.4)
|
44
44
|
builder (~> 3.1)
|
45
45
|
erubi (~> 1.4)
|
46
46
|
rails-dom-testing (~> 2.0)
|
47
47
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
48
|
-
activejob (6.0.
|
49
|
-
activesupport (= 6.0.
|
48
|
+
activejob (6.0.3.4)
|
49
|
+
activesupport (= 6.0.3.4)
|
50
50
|
globalid (>= 0.3.6)
|
51
|
-
activemodel (6.0.
|
52
|
-
activesupport (= 6.0.
|
53
|
-
activerecord (6.0.
|
54
|
-
activemodel (= 6.0.
|
55
|
-
activesupport (= 6.0.
|
56
|
-
activestorage (6.0.
|
57
|
-
actionpack (= 6.0.
|
58
|
-
activejob (= 6.0.
|
59
|
-
activerecord (= 6.0.
|
51
|
+
activemodel (6.0.3.4)
|
52
|
+
activesupport (= 6.0.3.4)
|
53
|
+
activerecord (6.0.3.4)
|
54
|
+
activemodel (= 6.0.3.4)
|
55
|
+
activesupport (= 6.0.3.4)
|
56
|
+
activestorage (6.0.3.4)
|
57
|
+
actionpack (= 6.0.3.4)
|
58
|
+
activejob (= 6.0.3.4)
|
59
|
+
activerecord (= 6.0.3.4)
|
60
60
|
marcel (~> 0.3.1)
|
61
|
-
activesupport (6.0.
|
61
|
+
activesupport (6.0.3.4)
|
62
62
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
63
63
|
i18n (>= 0.7, < 2)
|
64
64
|
minitest (~> 5.1)
|
65
65
|
tzinfo (~> 1.1)
|
66
|
-
zeitwerk (~> 2.2)
|
67
|
-
ast (2.4.
|
66
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
67
|
+
ast (2.4.1)
|
68
68
|
attr_encrypted (3.1.0)
|
69
69
|
encryptor (~> 3.0.0)
|
70
|
-
aws-eventstream (1.0
|
71
|
-
aws-partitions (1.
|
72
|
-
aws-sdk-core (3.
|
73
|
-
aws-eventstream (~> 1
|
70
|
+
aws-eventstream (1.1.0)
|
71
|
+
aws-partitions (1.416.0)
|
72
|
+
aws-sdk-core (3.111.1)
|
73
|
+
aws-eventstream (~> 1, >= 1.0.2)
|
74
74
|
aws-partitions (~> 1, >= 1.239.0)
|
75
75
|
aws-sigv4 (~> 1.1)
|
76
76
|
jmespath (~> 1.0)
|
77
|
-
aws-sdk-kms (1.
|
78
|
-
aws-sdk-core (~> 3, >= 3.
|
77
|
+
aws-sdk-kms (1.41.0)
|
78
|
+
aws-sdk-core (~> 3, >= 3.109.0)
|
79
79
|
aws-sigv4 (~> 1.1)
|
80
|
-
aws-sdk-s3 (1.
|
81
|
-
aws-sdk-core (~> 3, >= 3.
|
80
|
+
aws-sdk-s3 (1.87.0)
|
81
|
+
aws-sdk-core (~> 3, >= 3.109.0)
|
82
82
|
aws-sdk-kms (~> 1)
|
83
83
|
aws-sigv4 (~> 1.1)
|
84
|
-
aws-sigv4 (1.
|
85
|
-
aws-eventstream (~> 1
|
84
|
+
aws-sigv4 (1.2.2)
|
85
|
+
aws-eventstream (~> 1, >= 1.0.2)
|
86
86
|
builder (3.2.4)
|
87
|
-
bundler-audit (0.
|
87
|
+
bundler-audit (0.7.0.1)
|
88
88
|
bundler (>= 1.2.0, < 3)
|
89
|
-
thor (
|
90
|
-
codecov (0.
|
89
|
+
thor (>= 0.18, < 2)
|
90
|
+
codecov (0.2.5)
|
91
|
+
colorize
|
91
92
|
json
|
92
93
|
simplecov
|
93
|
-
|
94
|
-
concurrent-ruby (1.1.
|
95
|
-
crass (1.0.
|
94
|
+
colorize (0.8.1)
|
95
|
+
concurrent-ruby (1.1.7)
|
96
|
+
crass (1.0.6)
|
96
97
|
diff-lcs (1.3)
|
97
98
|
docile (1.3.2)
|
98
99
|
encryptor (3.0.0)
|
99
100
|
erubi (1.9.0)
|
100
|
-
factory_bot (
|
101
|
-
activesupport (>=
|
102
|
-
factory_bot_rails (
|
103
|
-
factory_bot (~>
|
104
|
-
railties (>=
|
105
|
-
ffi (1.
|
101
|
+
factory_bot (6.1.0)
|
102
|
+
activesupport (>= 5.0.0)
|
103
|
+
factory_bot_rails (6.1.0)
|
104
|
+
factory_bot (~> 6.1.0)
|
105
|
+
railties (>= 5.0.0)
|
106
|
+
ffi (1.14.2)
|
106
107
|
globalid (0.4.2)
|
107
108
|
activesupport (>= 4.2.0)
|
108
|
-
i18n (1.
|
109
|
+
i18n (1.8.5)
|
109
110
|
concurrent-ruby (~> 1.0)
|
110
|
-
jaro_winkler (1.5.4)
|
111
111
|
jmespath (1.4.0)
|
112
|
-
json (2.3.
|
113
|
-
loofah (2.
|
112
|
+
json (2.3.1)
|
113
|
+
loofah (2.7.0)
|
114
114
|
crass (~> 1.0.2)
|
115
115
|
nokogiri (>= 1.5.9)
|
116
116
|
mail (2.7.1)
|
117
117
|
mini_mime (>= 0.1.1)
|
118
118
|
marcel (0.3.3)
|
119
119
|
mimemagic (~> 0.3.2)
|
120
|
-
method_source (0.
|
121
|
-
mimemagic (0.3.
|
120
|
+
method_source (1.0.0)
|
121
|
+
mimemagic (0.3.5)
|
122
122
|
mini_mime (1.0.2)
|
123
|
-
mini_portile2 (2.
|
124
|
-
minitest (5.
|
125
|
-
msgpack (1.3.
|
126
|
-
nio4r (2.5.
|
127
|
-
nokogiri (1.
|
128
|
-
mini_portile2 (~> 2.
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
123
|
+
mini_portile2 (2.5.0)
|
124
|
+
minitest (5.14.2)
|
125
|
+
msgpack (1.3.3)
|
126
|
+
nio4r (2.5.4)
|
127
|
+
nokogiri (1.11.1)
|
128
|
+
mini_portile2 (~> 2.5.0)
|
129
|
+
racc (~> 1.4)
|
130
|
+
parallel (1.19.2)
|
131
|
+
parser (2.7.1.4)
|
132
|
+
ast (~> 2.4.1)
|
133
|
+
porky_lib (0.11.0)
|
133
134
|
aws-sdk-kms
|
134
135
|
aws-sdk-s3
|
135
136
|
msgpack
|
136
137
|
rbnacl (= 5.0.0)
|
137
138
|
rbnacl-libsodium
|
138
|
-
|
139
|
+
racc (1.5.2)
|
140
|
+
rack (2.2.3)
|
139
141
|
rack-test (1.1.0)
|
140
142
|
rack (>= 1.0, < 3)
|
141
|
-
rails (6.0.
|
142
|
-
actioncable (= 6.0.
|
143
|
-
actionmailbox (= 6.0.
|
144
|
-
actionmailer (= 6.0.
|
145
|
-
actionpack (= 6.0.
|
146
|
-
actiontext (= 6.0.
|
147
|
-
actionview (= 6.0.
|
148
|
-
activejob (= 6.0.
|
149
|
-
activemodel (= 6.0.
|
150
|
-
activerecord (= 6.0.
|
151
|
-
activestorage (= 6.0.
|
152
|
-
activesupport (= 6.0.
|
143
|
+
rails (6.0.3.4)
|
144
|
+
actioncable (= 6.0.3.4)
|
145
|
+
actionmailbox (= 6.0.3.4)
|
146
|
+
actionmailer (= 6.0.3.4)
|
147
|
+
actionpack (= 6.0.3.4)
|
148
|
+
actiontext (= 6.0.3.4)
|
149
|
+
actionview (= 6.0.3.4)
|
150
|
+
activejob (= 6.0.3.4)
|
151
|
+
activemodel (= 6.0.3.4)
|
152
|
+
activerecord (= 6.0.3.4)
|
153
|
+
activestorage (= 6.0.3.4)
|
154
|
+
activesupport (= 6.0.3.4)
|
153
155
|
bundler (>= 1.3.0)
|
154
|
-
railties (= 6.0.
|
156
|
+
railties (= 6.0.3.4)
|
155
157
|
sprockets-rails (>= 2.0.0)
|
156
158
|
rails-dom-testing (2.0.3)
|
157
159
|
activesupport (>= 4.2.0)
|
158
160
|
nokogiri (>= 1.6)
|
159
161
|
rails-html-sanitizer (1.3.0)
|
160
162
|
loofah (~> 2.3)
|
161
|
-
railties (6.0.
|
162
|
-
actionpack (= 6.0.
|
163
|
-
activesupport (= 6.0.
|
163
|
+
railties (6.0.3.4)
|
164
|
+
actionpack (= 6.0.3.4)
|
165
|
+
activesupport (= 6.0.3.4)
|
164
166
|
method_source
|
165
167
|
rake (>= 0.8.7)
|
166
168
|
thor (>= 0.20.3, < 2.0)
|
@@ -170,69 +172,73 @@ GEM
|
|
170
172
|
ffi
|
171
173
|
rbnacl-libsodium (1.0.16)
|
172
174
|
rbnacl (>= 3.0.1)
|
173
|
-
redis (4.
|
175
|
+
redis (4.2.5)
|
176
|
+
regexp_parser (1.7.1)
|
177
|
+
rexml (3.2.4)
|
174
178
|
rspec (3.9.0)
|
175
179
|
rspec-core (~> 3.9.0)
|
176
180
|
rspec-expectations (~> 3.9.0)
|
177
181
|
rspec-mocks (~> 3.9.0)
|
178
182
|
rspec-collection_matchers (1.2.0)
|
179
183
|
rspec-expectations (>= 2.99.0.beta1)
|
180
|
-
rspec-core (3.9.
|
181
|
-
rspec-support (~> 3.9.
|
182
|
-
rspec-expectations (3.9.
|
184
|
+
rspec-core (3.9.2)
|
185
|
+
rspec-support (~> 3.9.3)
|
186
|
+
rspec-expectations (3.9.2)
|
183
187
|
diff-lcs (>= 1.2.0, < 2.0)
|
184
188
|
rspec-support (~> 3.9.0)
|
185
189
|
rspec-mocks (3.9.1)
|
186
190
|
diff-lcs (>= 1.2.0, < 2.0)
|
187
191
|
rspec-support (~> 3.9.0)
|
188
|
-
rspec-rails (
|
189
|
-
actionpack (>=
|
190
|
-
activesupport (>=
|
191
|
-
railties (>=
|
192
|
-
rspec-core (~> 3.9
|
193
|
-
rspec-expectations (~> 3.9
|
194
|
-
rspec-mocks (~> 3.9
|
195
|
-
rspec-support (~> 3.9
|
196
|
-
rspec-support (3.9.
|
192
|
+
rspec-rails (4.0.1)
|
193
|
+
actionpack (>= 4.2)
|
194
|
+
activesupport (>= 4.2)
|
195
|
+
railties (>= 4.2)
|
196
|
+
rspec-core (~> 3.9)
|
197
|
+
rspec-expectations (~> 3.9)
|
198
|
+
rspec-mocks (~> 3.9)
|
199
|
+
rspec-support (~> 3.9)
|
200
|
+
rspec-support (3.9.3)
|
197
201
|
rspec_junit_formatter (0.4.1)
|
198
202
|
rspec-core (>= 2, < 4, != 2.12.0)
|
199
|
-
rubocop (0.
|
200
|
-
jaro_winkler (~> 1.5.1)
|
203
|
+
rubocop (0.89.0)
|
201
204
|
parallel (~> 1.10)
|
202
|
-
parser (>= 2.7.
|
205
|
+
parser (>= 2.7.1.1)
|
203
206
|
rainbow (>= 2.2.2, < 4.0)
|
207
|
+
regexp_parser (>= 1.7)
|
208
|
+
rexml
|
209
|
+
rubocop-ast (>= 0.1.0, < 1.0)
|
204
210
|
ruby-progressbar (~> 1.7)
|
205
|
-
unicode-display_width (>= 1.4.0, <
|
206
|
-
rubocop-
|
207
|
-
|
208
|
-
rubocop-
|
209
|
-
rubocop (>= 0.
|
211
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
212
|
+
rubocop-ast (0.3.0)
|
213
|
+
parser (>= 2.7.1.4)
|
214
|
+
rubocop-performance (1.7.1)
|
215
|
+
rubocop (>= 0.82.0)
|
216
|
+
rubocop-rspec (1.42.0)
|
217
|
+
rubocop (>= 0.87.0)
|
210
218
|
rubocop_runner (2.2.0)
|
211
219
|
ruby-progressbar (1.10.1)
|
212
|
-
simplecov (0.
|
220
|
+
simplecov (0.18.5)
|
213
221
|
docile (~> 1.1)
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
sprockets (4.0.0)
|
222
|
+
simplecov-html (~> 0.11)
|
223
|
+
simplecov-html (0.12.2)
|
224
|
+
sprockets (4.0.2)
|
218
225
|
concurrent-ruby (~> 1.0)
|
219
226
|
rack (> 1, < 3)
|
220
|
-
sprockets-rails (3.2.
|
227
|
+
sprockets-rails (3.2.2)
|
221
228
|
actionpack (>= 4.0)
|
222
229
|
activesupport (>= 4.0)
|
223
230
|
sprockets (>= 3.0.0)
|
224
231
|
sqlite3 (1.4.2)
|
225
|
-
thor (0.
|
232
|
+
thor (1.0.1)
|
226
233
|
thread_safe (0.3.6)
|
227
234
|
timecop (0.9.1)
|
228
|
-
tzinfo (1.2.
|
235
|
+
tzinfo (1.2.7)
|
229
236
|
thread_safe (~> 0.1)
|
230
|
-
unicode-display_width (1.
|
231
|
-
|
232
|
-
websocket-driver (0.7.1)
|
237
|
+
unicode-display_width (1.7.0)
|
238
|
+
websocket-driver (0.7.3)
|
233
239
|
websocket-extensions (>= 0.1.0)
|
234
|
-
websocket-extensions (0.1.
|
235
|
-
zeitwerk (2.
|
240
|
+
websocket-extensions (0.1.5)
|
241
|
+
zeitwerk (2.4.0)
|
236
242
|
|
237
243
|
PLATFORMS
|
238
244
|
ruby
|
@@ -259,7 +265,7 @@ DEPENDENCIES
|
|
259
265
|
timecop
|
260
266
|
|
261
267
|
RUBY VERSION
|
262
|
-
ruby 2.
|
268
|
+
ruby 2.7.2p137
|
263
269
|
|
264
270
|
BUNDLED WITH
|
265
|
-
2.
|
271
|
+
2.1.4
|
data/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright 2020 Thinking Capital Financial Corporation
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[](https://circleci.com/gh/Zetatango/daffy_lib) [](https://codecov.io/gh/Zetatango/daffy_lib) [](https://badge.fury.io/rb/daffy_lib)
|
1
|
+
[](https://circleci.com/gh/Zetatango/daffy_lib) [](https://codecov.io/gh/Zetatango/daffy_lib) [](https://badge.fury.io/rb/daffy_lib)
|
2
2
|
# DaffyLib
|
3
3
|
|
4
4
|
This gem is a caching encryptor which improves performance when encrypting/decrypting large amounts of data. It will keep a plaintext key cached for a given amount of time, as well as provide partitioning to allow entire rows to be encrypted with the same key. Keys are uniquely identified by a pair of a partition guid and an encryption epoch.
|
@@ -25,7 +25,7 @@ We illustrate usage of this library with an example. Suppose we have classes `U
|
|
25
25
|
|
26
26
|
The `User` class will need to `include DaffyLib::PartitionProvider` and implement the method `provider_partition_guid` which returns an identifier, for instance a user's `guid`.
|
27
27
|
|
28
|
-
The `User::Attribute` class will need to `include DaffyLib::PartitionProvider` as well as `include DaffyLib::HasEncryptedAttributes`. It will need to declare `partition_provider :user`.
|
28
|
+
The `User::Attribute` class will need to `include DaffyLib::PartitionProvider` as well as `include DaffyLib::HasEncryptedAttributes`. It will need to declare `partition_provider :user`.
|
29
29
|
|
30
30
|
There are default implementations of `generate_partition_guid` which returns the linked `User`'s `guid`, as well as a `generate_encryption_epoch` method which defines the encryption epoch, which are the following.
|
31
31
|
|
@@ -52,7 +52,7 @@ attr_encrypted :values, encryptor: ZtCachingEncryptor, encrypt_method: :zt_encry
|
|
52
52
|
encode: true, partition_guid: proc { |object| object.generate_partition_guid },
|
53
53
|
encryption_epoch: proc { |object| object.generate_encryption_epoch }, expires_in: 5.minutes
|
54
54
|
```
|
55
|
-
|
55
|
+
|
56
56
|
where the `expires_in` field denotes how long a plaintext key should be kept in cache.
|
57
57
|
|
58
58
|
Note further that a class can be its own partition provider; i.e. if `User` itself had encrypted attributes, all the steps above for `User::Attributes` apply, except there is no need to declare `partition_provider`, and the recommended implementation for `generate_partition_guid` is to return (or create) the `guid` of the `User`.
|
@@ -66,53 +66,50 @@ t.index [:guid], name: :index_encryption_keys_on_guid, unique: true
|
|
66
66
|
t.index [:partition_guid, :key_epoch], name: :index_encryption_keys, unique: true
|
67
67
|
|
68
68
|
```
|
69
|
-
Next,
|
69
|
+
Next, run `rake db:migrate:add_encryption_fields['modelname']` to add the `partition_guid` and `encryption_epoch` columns to each model.
|
70
70
|
|
71
|
-
|
72
|
-
```
|
73
|
-
def up
|
74
|
-
models = %i[users users/attributes]
|
71
|
+
Run `rake generate_encryption_attributes['modelname','limit']` to populate existing records of each model with the encryption attributes. The limit specifies the maximum number of records updated per execution; a limit of 0 means no limit.
|
75
72
|
|
76
|
-
|
73
|
+
Finally, once existing records have been populated, it is advisable to perform a final migration to set `partition_guid` and `encryption_epoch` columns to mandatory.
|
77
74
|
|
78
|
-
model_classname = model.to_s.camelize.singularize.constantize
|
79
|
-
model_tablename = model.to_s.gsub('/', '_')
|
80
75
|
|
81
|
-
|
82
|
-
add_column model_tablename, :encryption_epoch, :datetime
|
76
|
+
## Development
|
83
77
|
|
84
|
-
|
85
|
-
model_classname.find_each do |record|
|
86
|
-
record.generate_partition_guid
|
87
|
-
record.generate_encryption_epoch
|
78
|
+
Development on this project should occur on separate feature branches and pull requests should be submitted. When submitting a pull request, the pull request comment template should be filled out as much as possible to ensure a quick review and increase the likelihood of the pull request being accepted.
|
88
79
|
|
89
|
-
|
90
|
-
end
|
80
|
+
### Ruby
|
91
81
|
|
92
|
-
|
93
|
-
change_column model_tablename, :encryption_epoch, :datetime, null: false
|
94
|
-
end
|
95
|
-
end
|
82
|
+
This application requires:
|
96
83
|
|
97
|
-
|
98
|
-
models = %i[users users/attributes]
|
84
|
+
* Ruby version: 2.7.1
|
99
85
|
|
100
|
-
|
101
|
-
model_tablename = model.to_s.gsub('/', '_')
|
86
|
+
Ruby 2.7.1 and greater requires OpenSSL 1.1+. To link to Homebrew's upgraded version of OpenSSL, add the following to your bash profile
|
102
87
|
|
103
|
-
|
104
|
-
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
88
|
+
```shell script
|
89
|
+
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)"
|
108
90
|
```
|
109
91
|
|
92
|
+
If you do not have Ruby installed, it is recommended you use ruby-install and chruby to manage Ruby versions.
|
110
93
|
|
111
|
-
|
94
|
+
```bash
|
95
|
+
brew install ruby-install chruby
|
96
|
+
ruby-install ruby 2.7.1
|
97
|
+
```
|
112
98
|
|
113
|
-
|
99
|
+
Add the following lines to ~/.bash_profile:
|
100
|
+
|
101
|
+
```bash
|
102
|
+
source /usr/local/opt/chruby/share/chruby/chruby.sh
|
103
|
+
source /usr/local/opt/chruby/share/chruby/auto.sh
|
104
|
+
```
|
105
|
+
|
106
|
+
Set Ruby version to 2.7.1:
|
107
|
+
|
108
|
+
```bash
|
109
|
+
source ~/.bash_profile
|
110
|
+
chruby 2.7.1
|
111
|
+
```
|
114
112
|
|
115
113
|
## Contributing
|
116
114
|
|
117
115
|
Bug reports and pull requests are welcome on GitHub at https://github.com/Zetatango/daffy_lib.
|
118
|
-
|
data/daffy_lib.gemspec
CHANGED
@@ -11,7 +11,9 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.summary = 'A library for caching encryptor'
|
12
12
|
spec.homepage = 'https://github.com/Zetatango/daffy_lib'
|
13
13
|
|
14
|
-
spec.
|
14
|
+
spec.required_ruby_version = '>= 2.7.1'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
15
17
|
f.match(%r{^(test|spec|features)/})
|
16
18
|
end
|
17
19
|
spec.bindir = 'exe'
|
@@ -26,9 +28,9 @@ Gem::Specification.new do |spec|
|
|
26
28
|
spec.add_development_dependency 'rake'
|
27
29
|
spec.add_development_dependency 'rspec'
|
28
30
|
spec.add_development_dependency 'rspec-collection_matchers'
|
31
|
+
spec.add_development_dependency 'rspec_junit_formatter'
|
29
32
|
spec.add_development_dependency 'rspec-mocks'
|
30
33
|
spec.add_development_dependency 'rspec-rails'
|
31
|
-
spec.add_development_dependency 'rspec_junit_formatter'
|
32
34
|
spec.add_development_dependency 'rubocop'
|
33
35
|
spec.add_development_dependency 'rubocop-performance'
|
34
36
|
spec.add_development_dependency 'rubocop-rspec'
|
@@ -5,7 +5,7 @@ require 'active_support'
|
|
5
5
|
module DaffyLib::HasGuid
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
|
8
|
-
REGEXP =
|
8
|
+
REGEXP = /^\w+_\w+$/.freeze
|
9
9
|
|
10
10
|
mattr_accessor :registry do
|
11
11
|
{}
|
@@ -46,7 +46,7 @@ module DaffyLib::HasGuid
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def self.validation_regexp
|
49
|
-
/^#{has_guid_prefix}_
|
49
|
+
/^#{has_guid_prefix}_\w+$/
|
50
50
|
end
|
51
51
|
|
52
52
|
def ensure_guid_does_not_change
|
@@ -18,7 +18,7 @@ class DaffyLib::KeyManagementService
|
|
18
18
|
raise InvalidParameterException unless partition_guid.present? && expires_in.present? && cmk_key_id.present?
|
19
19
|
|
20
20
|
@partition_guid = partition_guid
|
21
|
-
@
|
21
|
+
@expires_in = expires_in
|
22
22
|
@cmk_key_id = cmk_key_id
|
23
23
|
end
|
24
24
|
|
@@ -8,11 +8,11 @@ class DaffyLib::StringValidator < ActiveModel::Validator
|
|
8
8
|
return if options[:fields].blank?
|
9
9
|
|
10
10
|
options[:fields].each do |field|
|
11
|
-
|
11
|
+
next if record.is_a?(ActiveRecord::Base) && !record.changed_attributes.include?(field)
|
12
12
|
|
13
13
|
sanitized_attr = ActionController::Base.helpers.sanitize(record[field])
|
14
14
|
decoded_attr = Nokogiri::HTML.parse(sanitized_attr.to_s)
|
15
|
-
record.errors[
|
15
|
+
record.errors[field] << 'contains invalid characters...' unless record[field] == decoded_attr.text || record[field].blank?
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
data/lib/daffy_lib/version.rb
CHANGED
data/lib/tasks/db_tasks.rake
CHANGED
@@ -25,5 +25,51 @@ namespace :db do
|
|
25
25
|
created_at:datetime \\
|
26
26
|
updated_at:datetime`
|
27
27
|
end
|
28
|
+
|
29
|
+
desc 'Migrates the database by generating partition guid and encryption epoch for the specified model'
|
30
|
+
task :generate_encryption_attributes, %i[model limit] => :environment do |_t, args|
|
31
|
+
model = args[:model].camelize
|
32
|
+
limit = args[:limit] || 1000
|
33
|
+
limit = limit.to_i
|
34
|
+
|
35
|
+
abort 'Need to provide `model` as argument' if model.blank?
|
36
|
+
|
37
|
+
model_classname = model.to_s.camelize.singularize.constantize
|
38
|
+
|
39
|
+
model_classname.instance_eval do
|
40
|
+
# Find all records that don't yet have a partition_guid
|
41
|
+
scope :pending_migration, -> { where(partition_guid: nil) }
|
42
|
+
end
|
43
|
+
|
44
|
+
model_classname.reset_column_information
|
45
|
+
|
46
|
+
records = limit.zero? ? model_classname.pending_migration : model_classname.pending_migration.limit(limit)
|
47
|
+
|
48
|
+
records.each do |record|
|
49
|
+
record.generate_partition_guid
|
50
|
+
record.generate_encryption_epoch
|
51
|
+
|
52
|
+
record.save!(validate: false)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
desc 'Migrates the database by performing read/write to re-encrypt specified attributes for the specified model'
|
57
|
+
task :re_encrypt_attributes, %i[model] => :environment do |_t, args|
|
58
|
+
model = args[:model].camelize
|
59
|
+
|
60
|
+
abort 'Need to provide `model` as argument' if model.blank?
|
61
|
+
|
62
|
+
model_classname = model.to_s.camelize.singularize.constantize
|
63
|
+
encrypted_attributes = model_classname.encrypted_attributes.keys
|
64
|
+
|
65
|
+
model_classname.all.each do |record|
|
66
|
+
encrypted_attributes.each do |attribute|
|
67
|
+
value = record.send(attribute)
|
68
|
+
record.send("#{attribute}=", value) unless value.blank?
|
69
|
+
end
|
70
|
+
|
71
|
+
record.save!(validate: false)
|
72
|
+
end
|
73
|
+
end
|
28
74
|
end
|
29
75
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daffy_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benoît Jeaurond, Weiyun Lu
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: attr_encrypted
|
@@ -123,7 +123,7 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: rspec_junit_formatter
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
@@ -137,7 +137,7 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name: rspec-
|
140
|
+
name: rspec-mocks
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - ">="
|
@@ -151,7 +151,7 @@ dependencies:
|
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
154
|
+
name: rspec-rails
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - ">="
|
@@ -304,7 +304,7 @@ dependencies:
|
|
304
304
|
- - ">="
|
305
305
|
- !ruby/object:Gem::Version
|
306
306
|
version: '0'
|
307
|
-
description:
|
307
|
+
description:
|
308
308
|
email:
|
309
309
|
- weiyun.lu@arioplatform.com
|
310
310
|
executables: []
|
@@ -319,12 +319,12 @@ files:
|
|
319
319
|
- CODEOWNERS
|
320
320
|
- Gemfile
|
321
321
|
- Gemfile.lock
|
322
|
+
- LICENSE
|
322
323
|
- README.md
|
323
324
|
- Rakefile
|
324
325
|
- SECURITY.MD
|
325
326
|
- bin/console
|
326
327
|
- bin/setup
|
327
|
-
- daffy_lib-0.1.0.gem
|
328
328
|
- daffy_lib.gemspec
|
329
329
|
- lib/daffy_lib.rb
|
330
330
|
- lib/daffy_lib/caching_encryptor.rb
|
@@ -341,7 +341,7 @@ files:
|
|
341
341
|
homepage: https://github.com/Zetatango/daffy_lib
|
342
342
|
licenses: []
|
343
343
|
metadata: {}
|
344
|
-
post_install_message:
|
344
|
+
post_install_message:
|
345
345
|
rdoc_options: []
|
346
346
|
require_paths:
|
347
347
|
- lib
|
@@ -349,15 +349,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
349
349
|
requirements:
|
350
350
|
- - ">="
|
351
351
|
- !ruby/object:Gem::Version
|
352
|
-
version:
|
352
|
+
version: 2.7.1
|
353
353
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
354
354
|
requirements:
|
355
355
|
- - ">="
|
356
356
|
- !ruby/object:Gem::Version
|
357
357
|
version: '0'
|
358
358
|
requirements: []
|
359
|
-
rubygems_version: 3.
|
360
|
-
signing_key:
|
359
|
+
rubygems_version: 3.1.4
|
360
|
+
signing_key:
|
361
361
|
specification_version: 4
|
362
362
|
summary: A library for caching encryptor
|
363
363
|
test_files: []
|
data/daffy_lib-0.1.0.gem
DELETED
Binary file
|