attr_encrypted 3.0.0 → 3.0.2
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
- checksums.yaml.gz.sig +0 -0
- data/.travis.yml +8 -1
- data/CHANGELOG.md +8 -0
- data/README.md +1 -1
- 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/lib/attr_encrypted/adapters/active_record.rb +12 -9
- data/lib/attr_encrypted/version.rb +1 -1
- data/test/active_record_test.rb +38 -34
- data/test/compatibility_test.rb +18 -20
- data/test/legacy_active_record_test.rb +6 -8
- data/test/legacy_compatibility_test.rb +12 -14
- data.tar.gz.sig +0 -0
- metadata +6 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4f35a7b7559ac43fbc20bf110b06c48457195c35
|
|
4
|
+
data.tar.gz: a99c8beb7a082c64d21f123aeb5c342dffbb80c2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 25d196cdd13c8c8f0b677583e734cd85e5eea7cf148c33c9317d9bc966481dd549a5513d1f89ac598e53086a4913ba2873184830d57dbc5b740413464397e89e
|
|
7
|
+
data.tar.gz: 344729a1eb162560e4519b851e0a736f81dddaad4c652338b1af568549d7ba5036c1a7f935b01a7805a1da4972aeb054ffa7b3980e571213ca10a08b75227e8b
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/.travis.yml
CHANGED
|
@@ -4,7 +4,7 @@ cache: bundler
|
|
|
4
4
|
rvm:
|
|
5
5
|
- 2.0
|
|
6
6
|
- 2.1
|
|
7
|
-
- 2.2
|
|
7
|
+
- 2.2.2
|
|
8
8
|
- 2.3.0
|
|
9
9
|
- rbx
|
|
10
10
|
env:
|
|
@@ -14,8 +14,15 @@ env:
|
|
|
14
14
|
- ACTIVERECORD=4.0.0
|
|
15
15
|
- ACTIVERECORD=4.1.0
|
|
16
16
|
- ACTIVERECORD=4.2.0
|
|
17
|
+
- ACTIVERECORD=5.0.0
|
|
17
18
|
matrix:
|
|
18
19
|
exclude:
|
|
20
|
+
- rvm: 2.0
|
|
21
|
+
env: ACTIVERECORD=5.0.0
|
|
22
|
+
- rvm: 2.1
|
|
23
|
+
env: ACTIVERECORD=5.0.0
|
|
24
|
+
- rvm: rbx
|
|
25
|
+
env: ACTIVERECORD=5.0.0
|
|
19
26
|
allow_failures:
|
|
20
27
|
- rvm: rbx
|
|
21
28
|
fast_finish: true
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# attr_encrypted #
|
|
2
2
|
|
|
3
|
+
## 3.0.2 ##
|
|
4
|
+
* Changed: Removed alias_method_chain for compatibility with Rails v5.x (@grosser)
|
|
5
|
+
* Changed: Updated Travis build matrix to include Rails 5. (@saghaulor) (@connorshea)
|
|
6
|
+
* Changed: Removed `.silence_stream` from tests as it has been removed from Rails 5. (@sblackstone)
|
|
7
|
+
|
|
8
|
+
## 3.0.1 ##
|
|
9
|
+
* Fixed: attr_was method no longer calls undefined methods. (@saghaulor)
|
|
10
|
+
|
|
3
11
|
## 3.0.0 ##
|
|
4
12
|
* Changed: Updated gemspec to use Encryptor v3.0.0. (@saghaulor)
|
|
5
13
|
* Changed: Updated README with instructions related to moving from v2.0.0 to v3.0.0. (@saghaulor)
|
data/README.md
CHANGED
|
@@ -403,7 +403,7 @@ It is recommended that you implement a strategy to insure that you do not mix th
|
|
|
403
403
|
attr_encrypted :ssn, key: :encryption_key, v2_gcm_iv: :is_decrypting?(:ssn)
|
|
404
404
|
|
|
405
405
|
def is_decrypting?(attribute)
|
|
406
|
-
|
|
406
|
+
encrypted_attributes[attribute][:operation] == :decrypting
|
|
407
407
|
end
|
|
408
408
|
end
|
|
409
409
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
845fc3cb09a19c3ac76192aba443788f92c880744617bca99b16fd31ce843e07
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
81a065442258cc3702aab62c7b2307a48ed3e0deb803600d11a7480cce0db7c43fd9929acd2755081042f8989236553fd694b6cb62776bbfc53f9165a22cbca1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
33140af4b223177db7a19efb2fa38472a299a745b29ca1c5ba9d3fa947390b77
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0c467cab98b9b2eb331f9818323a90ae01392d6cb03cf1f32faccc954d0fc54be65f0fc7bf751b0fce57925eef1c9e2af90181bc40d81ad93e21d15a001c53c6
|
|
@@ -6,19 +6,20 @@ if defined?(ActiveRecord::Base)
|
|
|
6
6
|
base.class_eval do
|
|
7
7
|
|
|
8
8
|
# https://github.com/attr-encrypted/attr_encrypted/issues/68
|
|
9
|
-
|
|
9
|
+
alias_method :reload_without_attr_encrypted, :reload
|
|
10
|
+
def reload(*args, &block)
|
|
10
11
|
result = reload_without_attr_encrypted(*args, &block)
|
|
11
12
|
self.class.encrypted_attributes.keys.each do |attribute_name|
|
|
12
13
|
instance_variable_set("@#{attribute_name}", nil)
|
|
13
14
|
end
|
|
14
15
|
result
|
|
15
16
|
end
|
|
16
|
-
alias_method_chain :reload, :attr_encrypted
|
|
17
17
|
|
|
18
18
|
attr_encrypted_options[:encode] = true
|
|
19
19
|
|
|
20
20
|
class << self
|
|
21
|
-
|
|
21
|
+
alias_method :method_missing_without_attr_encrypted, :method_missing
|
|
22
|
+
alias_method :method_missing, :method_missing_with_attr_encrypted
|
|
22
23
|
end
|
|
23
24
|
|
|
24
25
|
def perform_attribute_assignment(method, new_attributes, *args)
|
|
@@ -30,16 +31,16 @@ if defined?(ActiveRecord::Base)
|
|
|
30
31
|
private :perform_attribute_assignment
|
|
31
32
|
|
|
32
33
|
if ::ActiveRecord::VERSION::STRING > "3.1"
|
|
33
|
-
|
|
34
|
+
alias_method :assign_attributes_without_attr_encrypted, :assign_attributes
|
|
35
|
+
def assign_attributes(*args)
|
|
34
36
|
perform_attribute_assignment :assign_attributes_without_attr_encrypted, *args
|
|
35
37
|
end
|
|
36
|
-
alias_method_chain :assign_attributes, :attr_encrypted
|
|
37
38
|
end
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
alias_method :attributes_without_attr_encrypted=, :attributes=
|
|
41
|
+
def attributes=(*args)
|
|
40
42
|
perform_attribute_assignment :attributes_without_attr_encrypted=, *args
|
|
41
43
|
end
|
|
42
|
-
alias_method_chain :attributes=, :attr_encrypted
|
|
43
44
|
end
|
|
44
45
|
end
|
|
45
46
|
|
|
@@ -59,8 +60,10 @@ if defined?(ActiveRecord::Base)
|
|
|
59
60
|
end
|
|
60
61
|
|
|
61
62
|
define_method("#{attr}_was") do
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
attr_was_options = { operation: :decrypting }
|
|
64
|
+
attr_was_options[:iv]= send("#{options[:attribute]}_iv_was") if respond_to?("#{options[:attribute]}_iv_was")
|
|
65
|
+
attr_was_options[:salt]= send("#{options[:attribute]}_salt_was") if respond_to?("#{options[:attribute]}_salt_was")
|
|
66
|
+
encrypted_attributes[attr].merge!(attr_was_options)
|
|
64
67
|
evaluated_options = evaluated_attr_encrypted_options_for(attr)
|
|
65
68
|
[:iv, :salt, :operation].each { |key| encrypted_attributes[attr].delete(key) }
|
|
66
69
|
self.class.decrypt(attr, send("#{options[:attribute]}_was"), evaluated_options)
|
data/test/active_record_test.rb
CHANGED
|
@@ -3,40 +3,38 @@ require_relative 'test_helper'
|
|
|
3
3
|
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
|
|
4
4
|
|
|
5
5
|
def create_tables
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
t.string :mode
|
|
39
|
-
end
|
|
6
|
+
ActiveRecord::Schema.define(version: 1) do
|
|
7
|
+
create_table :people do |t|
|
|
8
|
+
t.string :encrypted_email
|
|
9
|
+
t.string :password
|
|
10
|
+
t.string :encrypted_credentials
|
|
11
|
+
t.binary :salt
|
|
12
|
+
t.binary :key_iv
|
|
13
|
+
t.string :encrypted_email_salt
|
|
14
|
+
t.string :encrypted_credentials_salt
|
|
15
|
+
t.string :encrypted_email_iv
|
|
16
|
+
t.string :encrypted_credentials_iv
|
|
17
|
+
end
|
|
18
|
+
create_table :accounts do |t|
|
|
19
|
+
t.string :encrypted_password
|
|
20
|
+
t.string :encrypted_password_iv
|
|
21
|
+
t.string :encrypted_password_salt
|
|
22
|
+
end
|
|
23
|
+
create_table :users do |t|
|
|
24
|
+
t.string :login
|
|
25
|
+
t.string :encrypted_password
|
|
26
|
+
t.string :encrypted_password_iv
|
|
27
|
+
t.boolean :is_admin
|
|
28
|
+
end
|
|
29
|
+
create_table :prime_ministers do |t|
|
|
30
|
+
t.string :encrypted_name
|
|
31
|
+
t.string :encrypted_name_iv
|
|
32
|
+
end
|
|
33
|
+
create_table :addresses do |t|
|
|
34
|
+
t.binary :encrypted_street
|
|
35
|
+
t.binary :encrypted_street_iv
|
|
36
|
+
t.binary :encrypted_zipcode
|
|
37
|
+
t.string :mode
|
|
40
38
|
end
|
|
41
39
|
end
|
|
42
40
|
end
|
|
@@ -192,6 +190,12 @@ class ActiveRecordTest < Minitest::Test
|
|
|
192
190
|
assert_equal original_email, person.email_was
|
|
193
191
|
person.email = 'test2@example.com'
|
|
194
192
|
assert_equal original_email, person.email_was
|
|
193
|
+
old_pm_name = "Winston Churchill"
|
|
194
|
+
pm = PrimeMinister.create!(name: old_pm_name)
|
|
195
|
+
assert_equal old_pm_name, pm.name_was
|
|
196
|
+
old_zipcode = "90210"
|
|
197
|
+
address = Address.create!(zipcode: old_zipcode, mode: "single_iv_and_salt")
|
|
198
|
+
assert_equal old_zipcode, address.zipcode_was
|
|
195
199
|
end
|
|
196
200
|
|
|
197
201
|
if ::ActiveRecord::VERSION::STRING > "4.0"
|
data/test/compatibility_test.rb
CHANGED
|
@@ -81,26 +81,24 @@ class CompatibilityTest < Minitest::Test
|
|
|
81
81
|
private
|
|
82
82
|
|
|
83
83
|
def create_tables
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
t.string :encrypted_birthdate_salt
|
|
103
|
-
end
|
|
84
|
+
ActiveRecord::Schema.define(:version => 1) do
|
|
85
|
+
create_table :nonmarshalling_pets do |t|
|
|
86
|
+
t.string :name
|
|
87
|
+
t.string :encrypted_nickname
|
|
88
|
+
t.string :encrypted_nickname_iv
|
|
89
|
+
t.string :encrypted_nickname_salt
|
|
90
|
+
t.string :encrypted_birthdate
|
|
91
|
+
t.string :encrypted_birthdate_iv
|
|
92
|
+
t.string :encrypted_birthdate_salt
|
|
93
|
+
end
|
|
94
|
+
create_table :marshalling_pets do |t|
|
|
95
|
+
t.string :name
|
|
96
|
+
t.string :encrypted_nickname
|
|
97
|
+
t.string :encrypted_nickname_iv
|
|
98
|
+
t.string :encrypted_nickname_salt
|
|
99
|
+
t.string :encrypted_birthdate
|
|
100
|
+
t.string :encrypted_birthdate_iv
|
|
101
|
+
t.string :encrypted_birthdate_salt
|
|
104
102
|
end
|
|
105
103
|
end
|
|
106
104
|
end
|
|
@@ -4,14 +4,12 @@ require_relative 'test_helper'
|
|
|
4
4
|
ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => ':memory:'
|
|
5
5
|
|
|
6
6
|
def create_people_table
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
t.string :salt
|
|
14
|
-
end
|
|
7
|
+
ActiveRecord::Schema.define(:version => 1) do
|
|
8
|
+
create_table :legacy_people do |t|
|
|
9
|
+
t.string :encrypted_email
|
|
10
|
+
t.string :password
|
|
11
|
+
t.string :encrypted_credentials
|
|
12
|
+
t.string :salt
|
|
15
13
|
end
|
|
16
14
|
end
|
|
17
15
|
end
|
|
@@ -73,20 +73,18 @@ class LegacyCompatibilityTest < Minitest::Test
|
|
|
73
73
|
private
|
|
74
74
|
|
|
75
75
|
def create_tables
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
t.string :salt
|
|
89
|
-
end
|
|
76
|
+
ActiveRecord::Schema.define(:version => 1) do
|
|
77
|
+
create_table :legacy_nonmarshalling_pets do |t|
|
|
78
|
+
t.string :name
|
|
79
|
+
t.string :encrypted_nickname
|
|
80
|
+
t.string :encrypted_birthdate
|
|
81
|
+
t.string :salt
|
|
82
|
+
end
|
|
83
|
+
create_table :legacy_marshalling_pets do |t|
|
|
84
|
+
t.string :name
|
|
85
|
+
t.string :encrypted_nickname
|
|
86
|
+
t.string :encrypted_birthdate
|
|
87
|
+
t.string :salt
|
|
90
88
|
end
|
|
91
89
|
end
|
|
92
90
|
end
|
data.tar.gz.sig
CHANGED
|
Binary file
|
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: 3.0.
|
|
4
|
+
version: 3.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sean Huber
|
|
@@ -33,7 +33,7 @@ cert_chain:
|
|
|
33
33
|
ZjeLmnSDiwL6doiP5IiwALH/dcHU67ck3NGf6XyqNwQrrmtPY0mv1WVVL4Uh+vYE
|
|
34
34
|
kHoFzE2no0BfBg78Re8fY69P5yES5ncC
|
|
35
35
|
-----END CERTIFICATE-----
|
|
36
|
-
date: 2016-
|
|
36
|
+
date: 2016-07-15 00:00:00.000000000 Z
|
|
37
37
|
dependencies:
|
|
38
38
|
- !ruby/object:Gem::Dependency
|
|
39
39
|
name: encryptor
|
|
@@ -222,6 +222,10 @@ files:
|
|
|
222
222
|
- Rakefile
|
|
223
223
|
- attr_encrypted.gemspec
|
|
224
224
|
- certs/saghaulor.pem
|
|
225
|
+
- checksum/attr_encrypted-3.0.0.gem.sha256
|
|
226
|
+
- checksum/attr_encrypted-3.0.0.gem.sha512
|
|
227
|
+
- checksum/attr_encrypted-3.0.1.gem.sha256
|
|
228
|
+
- checksum/attr_encrypted-3.0.1.gem.sha512
|
|
225
229
|
- lib/attr_encrypted.rb
|
|
226
230
|
- lib/attr_encrypted/adapters/active_record.rb
|
|
227
231
|
- lib/attr_encrypted/adapters/data_mapper.rb
|
metadata.gz.sig
CHANGED
|
Binary file
|