attr_keyring 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2fdee29d790a2b8e6f3dedbe485e3f01eafc6ff1c076e6845aac1b321f3b9e18
4
- data.tar.gz: afc222122dd43e545173656e9c93f7a8f39e1fdf51d403ce857d3796cbedcc50
3
+ metadata.gz: bf52bc4c9faa76f061e0023bf8bf21cfe9de59a5ff1ce608392b388957be85db
4
+ data.tar.gz: 3b5e4145a2704b00b5784b49fd949172e66629499d0eccaaf5f237b8a1828b70
5
5
  SHA512:
6
- metadata.gz: cf8a11057e8802e993ade45fea165daafd6d8d1c6a6719bef14c42391e9f6879b407fa4735c1f97374daa76b4942effc6264d4d431347938b7c6599bebd25cdd
7
- data.tar.gz: 1c7b23f681512d0bca2ad00d1f4650dc0c84d7b048c5b129ddbd94fe972f42d076a0d22c9c2cdfdeefb573ece82f298a3c8e9e2567deb50481322ed1023355e7
6
+ metadata.gz: bf408bfc13aa86d353d345c47a08a40d04113408f3a7d20c9a7ba0e6cc347c12b5adf533fe0c250764cc0df330b283a96ee2a6db4cacff7ce61b20c07614772d
7
+ data.tar.gz: 4a38d54dbf79ad34a9b9a54bbdbc655382e4ab128209ec4f73fbcb62df46b0040519a47c394dffabc4b567e5c852a89c91ee6bfe5d35c8ed4b10dfbe1943b270
@@ -68,7 +68,7 @@ module AttrKeyring
68
68
  module InstanceMethods
69
69
  private def attr_encrypt_column(attribute, value)
70
70
  clear_decrypted_column_cache(attribute)
71
- return reset_encrypted_column(attribute) unless value
71
+ return reset_encrypted_column(attribute) unless encryptable_value?(value)
72
72
 
73
73
  value = value.to_s
74
74
 
@@ -108,7 +108,7 @@ module AttrKeyring
108
108
 
109
109
  self.class.encrypted_attributes.each do |attribute|
110
110
  value = public_send(attribute)
111
- next if value.nil?
111
+ next unless encryptable_value?(value)
112
112
 
113
113
  encrypted_value, _, digest = self.class.keyring.encrypt(value)
114
114
 
@@ -118,5 +118,12 @@ module AttrKeyring
118
118
 
119
119
  public_send("#{self.class.keyring_column_name}=", keyring_id)
120
120
  end
121
+
122
+ private def encryptable_value?(value)
123
+ return false if value.nil?
124
+ return false if value.is_a?(String) && value.empty?
125
+
126
+ true
127
+ end
121
128
  end
122
129
  end
@@ -1,3 +1,3 @@
1
1
  module AttrKeyring
2
- VERSION = "0.5.1".freeze
2
+ VERSION = "0.5.2".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attr_keyring
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-13 00:00:00.000000000 Z
11
+ date: 2019-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -213,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
213
  - !ruby/object:Gem::Version
214
214
  version: '0'
215
215
  requirements: []
216
- rubygems_version: 3.0.1
216
+ rubygems_version: 3.0.3
217
217
  signing_key:
218
218
  specification_version: 4
219
219
  summary: Simple encryption-at-rest plugin for ActiveRecord.