symmetric-encryption 4.4.0 → 4.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/symmetric_encryption/config.rb +8 -2
- data/lib/symmetric_encryption/version.rb +1 -1
- data/lib/symmetric_encryption.rb +4 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc6728652282c5b73acde1b45427e7dbce0092ceecc197a052f5364b83c53e28
|
4
|
+
data.tar.gz: dad8b275ffd46adf20d2b3f51c7673b79e1cc359750626d4207f203a207c14f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efd513c2c0b22b5252583a3d8207d89f907b695f6edf6c75d0f7a2c9177e8d32d5566d7228f36b7039318d4e72380f4cee4090048cf40f7bf50a492bf525fcc5
|
7
|
+
data.tar.gz: bac21c5250923fd85134cc3a59e220ec2c87c85e4dc7f4efef280110c01852dd202256bcad5671d96dd7c7424c531b2bd237f0f9f85d5ac22bce24415ab6fcde
|
@@ -27,7 +27,7 @@ module SymmetricEncryption
|
|
27
27
|
|
28
28
|
# Reads the entire configuration for all environments from the supplied file name.
|
29
29
|
def self.read_file(file_name)
|
30
|
-
config =
|
30
|
+
config = load_yaml(ERB.new(File.new(file_name).read).result)
|
31
31
|
config = deep_symbolize_keys(config)
|
32
32
|
config.each_pair { |_env, cfg| SymmetricEncryption::Config.send(:migrate_old_formats!, cfg) }
|
33
33
|
config
|
@@ -75,7 +75,7 @@ module SymmetricEncryption
|
|
75
75
|
begin
|
76
76
|
raise(ConfigError, "Cannot find config file: #{file_name}") unless File.exist?(file_name)
|
77
77
|
|
78
|
-
env_config =
|
78
|
+
env_config = self.class.load_yaml(ERB.new(File.new(file_name).read).result)[env]
|
79
79
|
raise(ConfigError, "Cannot find environment: #{env} in config file: #{file_name}") unless env_config
|
80
80
|
|
81
81
|
env_config = self.class.send(:deep_symbolize_keys, env_config)
|
@@ -163,5 +163,11 @@ module SymmetricEncryption
|
|
163
163
|
end
|
164
164
|
|
165
165
|
private_class_method :migrate_old_formats!
|
166
|
+
|
167
|
+
def self.load_yaml(src)
|
168
|
+
return YAML.safe_load(src, permitted_classes: [Symbol], aliases: true) if Psych::VERSION.to_i >= 4
|
169
|
+
|
170
|
+
YAML.load(src)
|
171
|
+
end
|
166
172
|
end
|
167
173
|
end
|
data/lib/symmetric_encryption.rb
CHANGED
@@ -17,7 +17,10 @@ begin
|
|
17
17
|
ActiveRecord::Type.register(:encrypted, SymmetricEncryption::ActiveRecord::EncryptedAttribute)
|
18
18
|
end
|
19
19
|
|
20
|
-
|
20
|
+
# Remove old way of defining attributes with Rails 7 since it conflicts with the method names.
|
21
|
+
if ActiveRecord.version <= Gem::Version.new("7.0.0")
|
22
|
+
ActiveRecord::Base.include(SymmetricEncryption::ActiveRecord::AttrEncrypted)
|
23
|
+
end
|
21
24
|
end
|
22
25
|
|
23
26
|
ActiveSupport.on_load(:mongoid) do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: symmetric-encryption
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reid Morrison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coercible
|
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '0'
|
88
88
|
requirements: []
|
89
|
-
rubygems_version: 3.
|
89
|
+
rubygems_version: 3.3.7
|
90
90
|
signing_key:
|
91
91
|
specification_version: 4
|
92
92
|
summary: Encrypt ActiveRecord and Mongoid attributes, files and passwords in configuration
|