attr_encrypted 3.0.0 → 4.0.0
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 +5 -5
- data/.travis.yml +14 -16
- data/CHANGELOG.md +60 -14
- data/README.md +27 -9
- data/Rakefile +3 -0
- data/attr_encrypted.gemspec +6 -13
- data/checksum/attr_encrypted-3.0.0.gem.sha256 +1 -0
- data/checksum/attr_encrypted-3.0.0.gem.sha512 +1 -0
- data/checksum/attr_encrypted-3.0.1.gem.sha256 +1 -0
- data/checksum/attr_encrypted-3.0.1.gem.sha512 +1 -0
- data/checksum/attr_encrypted-3.0.2.gem.sha256 +1 -0
- data/checksum/attr_encrypted-3.0.2.gem.sha512 +1 -0
- data/checksum/attr_encrypted-3.0.3.gem.sha256 +1 -0
- data/checksum/attr_encrypted-3.0.3.gem.sha512 +1 -0
- data/checksum/attr_encrypted-3.1.0.gem.sha256 +1 -0
- data/checksum/attr_encrypted-3.1.0.gem.sha512 +1 -0
- data/lib/attr_encrypted/adapters/active_record.rb +58 -30
- data/lib/attr_encrypted/adapters/data_mapper.rb +3 -1
- data/lib/attr_encrypted/adapters/sequel.rb +3 -1
- data/lib/attr_encrypted/version.rb +3 -1
- data/lib/attr_encrypted.rb +160 -129
- data/test/active_record_test.rb +130 -104
- data/test/attr_encrypted_test.rb +113 -16
- data/test/compatibility_test.rb +21 -21
- data/test/data_mapper_test.rb +2 -0
- data/test/legacy_active_record_test.rb +9 -9
- data/test/legacy_attr_encrypted_test.rb +8 -6
- data/test/legacy_compatibility_test.rb +15 -15
- data/test/legacy_data_mapper_test.rb +2 -0
- data/test/legacy_sequel_test.rb +2 -0
- data/test/run.sh +15 -7
- data/test/sequel_test.rb +2 -0
- data/test/test_helper.rb +11 -5
- metadata +27 -50
- checksums.yaml.gz.sig +0 -0
- data/certs/saghaulor.pem +0 -21
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# -*- encoding: utf-8 -*-
|
2
4
|
require_relative 'test_helper'
|
3
5
|
|
@@ -56,11 +58,11 @@ end
|
|
56
58
|
class LegacyAttrEncryptedTest < Minitest::Test
|
57
59
|
|
58
60
|
def test_should_store_email_in_encrypted_attributes
|
59
|
-
assert LegacyUser.
|
61
|
+
assert LegacyUser.attr_encrypted_encrypted_attributes.include?(:email)
|
60
62
|
end
|
61
63
|
|
62
64
|
def test_should_not_store_salt_in_encrypted_attributes
|
63
|
-
assert !LegacyUser.
|
65
|
+
assert !LegacyUser.attr_encrypted_encrypted_attributes.include?(:salt)
|
64
66
|
end
|
65
67
|
|
66
68
|
def test_attr_encrypted_should_return_true_for_email
|
@@ -68,7 +70,7 @@ class LegacyAttrEncryptedTest < Minitest::Test
|
|
68
70
|
end
|
69
71
|
|
70
72
|
def test_attr_encrypted_should_not_use_the_same_attribute_name_for_two_attributes_in_the_same_line
|
71
|
-
refute_equal LegacyUser.
|
73
|
+
refute_equal LegacyUser.attr_encrypted_encrypted_attributes[:email][:attribute], LegacyUser.attr_encrypted_encrypted_attributes[:without_encoding][:attribute]
|
72
74
|
end
|
73
75
|
|
74
76
|
def test_attr_encrypted_should_return_false_for_salt
|
@@ -199,7 +201,7 @@ class LegacyAttrEncryptedTest < Minitest::Test
|
|
199
201
|
end
|
200
202
|
|
201
203
|
def test_should_inherit_encrypted_attributes
|
202
|
-
assert_equal [LegacyUser.
|
204
|
+
assert_equal [LegacyUser.attr_encrypted_encrypted_attributes.keys, :testing].flatten.collect { |key| key.to_s }.sort, LegacyAdmin.attr_encrypted_encrypted_attributes.keys.collect { |key| key.to_s }.sort
|
203
205
|
end
|
204
206
|
|
205
207
|
def test_should_inherit_attr_encrypted_options
|
@@ -209,7 +211,7 @@ class LegacyAttrEncryptedTest < Minitest::Test
|
|
209
211
|
|
210
212
|
def test_should_not_inherit_unrelated_attributes
|
211
213
|
assert LegacySomeOtherClass.attr_encrypted_options.empty?
|
212
|
-
assert LegacySomeOtherClass.
|
214
|
+
assert LegacySomeOtherClass.attr_encrypted_encrypted_attributes.empty?
|
213
215
|
end
|
214
216
|
|
215
217
|
def test_should_evaluate_a_symbol_option
|
@@ -266,7 +268,7 @@ class LegacyAttrEncryptedTest < Minitest::Test
|
|
266
268
|
end
|
267
269
|
|
268
270
|
def test_should_work_with_aliased_attr_encryptor
|
269
|
-
assert LegacyUser.
|
271
|
+
assert LegacyUser.attr_encrypted_encrypted_attributes.include?(:aliased)
|
270
272
|
end
|
271
273
|
|
272
274
|
def test_should_always_reset_options
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# -*- encoding: utf-8 -*-
|
2
4
|
require_relative 'test_helper'
|
3
5
|
|
@@ -41,7 +43,7 @@ class LegacyCompatibilityTest < Minitest::Test
|
|
41
43
|
end
|
42
44
|
|
43
45
|
def setup
|
44
|
-
|
46
|
+
drop_all_tables
|
45
47
|
create_tables
|
46
48
|
end
|
47
49
|
|
@@ -73,20 +75,18 @@ class LegacyCompatibilityTest < Minitest::Test
|
|
73
75
|
private
|
74
76
|
|
75
77
|
def create_tables
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
t.string :salt
|
89
|
-
end
|
78
|
+
ActiveRecord::Schema.define(:version => 1) do
|
79
|
+
create_table :legacy_nonmarshalling_pets do |t|
|
80
|
+
t.string :name
|
81
|
+
t.string :encrypted_nickname
|
82
|
+
t.string :encrypted_birthdate
|
83
|
+
t.string :salt
|
84
|
+
end
|
85
|
+
create_table :legacy_marshalling_pets do |t|
|
86
|
+
t.string :name
|
87
|
+
t.string :encrypted_nickname
|
88
|
+
t.string :encrypted_birthdate
|
89
|
+
t.string :salt
|
90
90
|
end
|
91
91
|
end
|
92
92
|
end
|
data/test/legacy_sequel_test.rb
CHANGED
data/test/run.sh
CHANGED
@@ -1,12 +1,20 @@
|
|
1
|
-
#!/usr/bin/env
|
1
|
+
#!/usr/bin/env bash
|
2
2
|
|
3
|
-
|
3
|
+
set -e
|
4
|
+
|
5
|
+
for RUBY in 2.6.10 2.7.6
|
4
6
|
do
|
5
|
-
for
|
7
|
+
for ACTIVERECORD in 5.1.1 5.2.8
|
6
8
|
do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
echo ">>> Testing with Ruby ${RUBY} and ActiveRecord ${ACTIVERECORD}."
|
10
|
+
export RBENV_VERSION=$RUBY
|
11
|
+
export ACTIVERECORD=$ACTIVERECORD
|
12
|
+
|
13
|
+
rbenv install $RUBY --skip-existing
|
14
|
+
bundle install
|
15
|
+
bundle check
|
16
|
+
bundle exec rake test
|
17
|
+
rm Gemfile.lock
|
18
|
+
echo ">>> Finished testing with Ruby ${RUBY} and ActiveRecord ${ACTIVERECORD}."
|
11
19
|
done
|
12
20
|
done
|
data/test/sequel_test.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'pry'
|
1
4
|
require 'simplecov'
|
2
5
|
require 'simplecov-rcov'
|
3
|
-
require "codeclimate-test-reporter"
|
4
6
|
|
5
7
|
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
|
6
8
|
[
|
7
9
|
SimpleCov::Formatter::HTMLFormatter,
|
8
|
-
SimpleCov::Formatter::RcovFormatter
|
9
|
-
CodeClimate::TestReporter::Formatter
|
10
|
+
SimpleCov::Formatter::RcovFormatter
|
10
11
|
]
|
11
12
|
)
|
12
13
|
|
@@ -14,8 +15,6 @@ SimpleCov.start do
|
|
14
15
|
add_filter 'test'
|
15
16
|
end
|
16
17
|
|
17
|
-
CodeClimate::TestReporter.start
|
18
|
-
|
19
18
|
require 'minitest/autorun'
|
20
19
|
|
21
20
|
# Rails 4.0.x pins to an old minitest
|
@@ -27,6 +26,7 @@ require 'active_record'
|
|
27
26
|
require 'data_mapper'
|
28
27
|
require 'digest/sha2'
|
29
28
|
require 'sequel'
|
29
|
+
ActiveSupport::Deprecation.behavior = :raise
|
30
30
|
|
31
31
|
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
32
32
|
$:.unshift(File.dirname(__FILE__))
|
@@ -49,3 +49,9 @@ SECRET_KEY = SecureRandom.random_bytes(32)
|
|
49
49
|
def base64_encoding_regex
|
50
50
|
/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{4})$/
|
51
51
|
end
|
52
|
+
|
53
|
+
def drop_all_tables
|
54
|
+
connection = ActiveRecord::Base.connection
|
55
|
+
tables = (ActiveRecord::VERSION::MAJOR >= 5 ? connection.data_sources : connection.tables)
|
56
|
+
tables.each { |table| ActiveRecord::Base.connection.drop_table(table) }
|
57
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attr_encrypted
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Huber
|
@@ -10,30 +10,8 @@ authors:
|
|
10
10
|
- Stephen Aghaulor
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
|
-
cert_chain:
|
14
|
-
-
|
15
|
-
-----BEGIN CERTIFICATE-----
|
16
|
-
MIIDdDCCAlygAwIBAgIBATANBgkqhkiG9w0BAQUFADBAMRIwEAYDVQQDDAlzYWdo
|
17
|
-
YXVsb3IxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
18
|
-
bTAeFw0xNjAxMTEyMjQyMDFaFw0xNzAxMTAyMjQyMDFaMEAxEjAQBgNVBAMMCXNh
|
19
|
-
Z2hhdWxvcjE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v1WVVL4Uh+vYE
|
34
|
-
kHoFzE2no0BfBg78Re8fY69P5yES5ncC
|
35
|
-
-----END CERTIFICATE-----
|
36
|
-
date: 2016-03-29 00:00:00.000000000 Z
|
13
|
+
cert_chain: []
|
14
|
+
date: 2023-04-06 00:00:00.000000000 Z
|
37
15
|
dependencies:
|
38
16
|
- !ruby/object:Gem::Dependency
|
39
17
|
name: encryptor
|
@@ -137,16 +115,16 @@ dependencies:
|
|
137
115
|
name: sqlite3
|
138
116
|
requirement: !ruby/object:Gem::Requirement
|
139
117
|
requirements:
|
140
|
-
- -
|
118
|
+
- - '='
|
141
119
|
- !ruby/object:Gem::Version
|
142
|
-
version:
|
120
|
+
version: 1.5.4
|
143
121
|
type: :development
|
144
122
|
prerelease: false
|
145
123
|
version_requirements: !ruby/object:Gem::Requirement
|
146
124
|
requirements:
|
147
|
-
- -
|
125
|
+
- - '='
|
148
126
|
- !ruby/object:Gem::Version
|
149
|
-
version:
|
127
|
+
version: 1.5.4
|
150
128
|
- !ruby/object:Gem::Dependency
|
151
129
|
name: dm-sqlite-adapter
|
152
130
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,7 +140,7 @@ dependencies:
|
|
162
140
|
- !ruby/object:Gem::Version
|
163
141
|
version: '0'
|
164
142
|
- !ruby/object:Gem::Dependency
|
165
|
-
name:
|
143
|
+
name: pry
|
166
144
|
requirement: !ruby/object:Gem::Requirement
|
167
145
|
requirements:
|
168
146
|
- - ">="
|
@@ -176,7 +154,7 @@ dependencies:
|
|
176
154
|
- !ruby/object:Gem::Version
|
177
155
|
version: '0'
|
178
156
|
- !ruby/object:Gem::Dependency
|
179
|
-
name: simplecov
|
157
|
+
name: simplecov
|
180
158
|
requirement: !ruby/object:Gem::Requirement
|
181
159
|
requirements:
|
182
160
|
- - ">="
|
@@ -190,7 +168,7 @@ dependencies:
|
|
190
168
|
- !ruby/object:Gem::Version
|
191
169
|
version: '0'
|
192
170
|
- !ruby/object:Gem::Dependency
|
193
|
-
name:
|
171
|
+
name: simplecov-rcov
|
194
172
|
requirement: !ruby/object:Gem::Requirement
|
195
173
|
requirements:
|
196
174
|
- - ">="
|
@@ -221,7 +199,16 @@ files:
|
|
221
199
|
- README.md
|
222
200
|
- Rakefile
|
223
201
|
- attr_encrypted.gemspec
|
224
|
-
-
|
202
|
+
- checksum/attr_encrypted-3.0.0.gem.sha256
|
203
|
+
- checksum/attr_encrypted-3.0.0.gem.sha512
|
204
|
+
- checksum/attr_encrypted-3.0.1.gem.sha256
|
205
|
+
- checksum/attr_encrypted-3.0.1.gem.sha512
|
206
|
+
- checksum/attr_encrypted-3.0.2.gem.sha256
|
207
|
+
- checksum/attr_encrypted-3.0.2.gem.sha512
|
208
|
+
- checksum/attr_encrypted-3.0.3.gem.sha256
|
209
|
+
- checksum/attr_encrypted-3.0.3.gem.sha512
|
210
|
+
- checksum/attr_encrypted-3.1.0.gem.sha256
|
211
|
+
- checksum/attr_encrypted-3.1.0.gem.sha512
|
225
212
|
- lib/attr_encrypted.rb
|
226
213
|
- lib/attr_encrypted/adapters/active_record.rb
|
227
214
|
- lib/attr_encrypted/adapters/data_mapper.rb
|
@@ -240,41 +227,32 @@ files:
|
|
240
227
|
- test/sequel_test.rb
|
241
228
|
- test/test_helper.rb
|
242
229
|
homepage: http://github.com/attr-encrypted/attr_encrypted
|
243
|
-
licenses:
|
230
|
+
licenses:
|
231
|
+
- MIT
|
244
232
|
metadata: {}
|
245
233
|
post_install_message: |2+
|
246
234
|
|
247
235
|
|
248
236
|
|
249
|
-
WARNING:
|
250
|
-
|
251
|
-
Additionally, there was a bug in Encryptor v2.0.0 that insecurely encrypted data when using an AES-*-GCM algorithm.
|
252
|
-
|
253
|
-
This bug was fixed but introduced breaking changes between v2.x and v3.x.
|
254
|
-
|
255
|
-
Please see the README for more information regarding upgrading to attr_encrypted v3.0.0.
|
237
|
+
WARNING: Using `#encrypted_attributes` is no longer supported. Instead, use `#attr_encrypted_encrypted_attributes` to avoid
|
238
|
+
collision with Active Record 7 native encryption.
|
256
239
|
|
257
240
|
|
258
|
-
rdoc_options:
|
259
|
-
- "--line-numbers"
|
260
|
-
- "--inline-source"
|
261
|
-
- "--main"
|
262
|
-
- README.rdoc
|
241
|
+
rdoc_options: []
|
263
242
|
require_paths:
|
264
243
|
- lib
|
265
244
|
required_ruby_version: !ruby/object:Gem::Requirement
|
266
245
|
requirements:
|
267
246
|
- - ">="
|
268
247
|
- !ruby/object:Gem::Version
|
269
|
-
version: 2.
|
248
|
+
version: 2.6.0
|
270
249
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
271
250
|
requirements:
|
272
251
|
- - ">="
|
273
252
|
- !ruby/object:Gem::Version
|
274
253
|
version: '0'
|
275
254
|
requirements: []
|
276
|
-
|
277
|
-
rubygems_version: 2.4.5.1
|
255
|
+
rubygems_version: 3.0.3.1
|
278
256
|
signing_key:
|
279
257
|
specification_version: 4
|
280
258
|
summary: Encrypt and decrypt attributes
|
@@ -291,4 +269,3 @@ test_files:
|
|
291
269
|
- test/run.sh
|
292
270
|
- test/sequel_test.rb
|
293
271
|
- test/test_helper.rb
|
294
|
-
has_rdoc: false
|
checksums.yaml.gz.sig
DELETED
Binary file
|
data/certs/saghaulor.pem
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
-----BEGIN CERTIFICATE-----
|
2
|
-
MIIDdDCCAlygAwIBAgIBATANBgkqhkiG9w0BAQUFADBAMRIwEAYDVQQDDAlzYWdo
|
3
|
-
YXVsb3IxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
4
|
-
bTAeFw0xNjAxMTEyMjQyMDFaFw0xNzAxMTAyMjQyMDFaMEAxEjAQBgNVBAMMCXNh
|
5
|
-
Z2hhdWxvcjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYD
|
6
|
-
Y29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx0xdQYk2GwCpQ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