attr_encrypted_pgcrypto 1.3.1 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +50 -41
- data/README.md +4 -4
- data/app_container_name +1 -0
- data/attr_encrypted_pgcrypto.gemspec +3 -3
- data/docker-compose.yml +15 -0
- data/docker/Dockerfile +14 -0
- data/docker/database-config +2 -0
- data/docker/startup +6 -0
- data/lib/attr_encrypted_pgcrypto/log_subscriber/postgres_pgp.rb +3 -14
- data/lib/attr_encrypted_pgcrypto/version.rb +1 -1
- data/spec/default.database.yml +4 -3
- data/spec/log_subscriber/postgres_pgp_spec.rb +2 -2
- data/spec/spec_helper.rb +0 -10
- metadata +31 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4aa881515a4fafd5699515cf843f1c3f925fdc91
|
4
|
+
data.tar.gz: f8c489b58ea6a9f7a80940f45908889d01dab5e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 383dedbc4b9285b92412e878a5553771c732ca990a20471e934a93da567ca912e5aec6764643d1fda49aa19a32ae30eaa6c2b82e904fe20180e37a861e7b5900
|
7
|
+
data.tar.gz: 59a51f1a8c11f455f40aa9dbeee6c440841f3d565dcaa2843a3c9f0e42149629f6c2e3e7e13f9838901b6bef7a925270619f061b907c6ea965a07659fad82fee
|
data/Gemfile.lock
CHANGED
@@ -1,58 +1,67 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
attr_encrypted_pgcrypto (1.
|
4
|
+
attr_encrypted_pgcrypto (1.3.1)
|
5
5
|
activerecord (>= 3.0)
|
6
6
|
activesupport (>= 3.0)
|
7
|
-
attr_encrypted (
|
7
|
+
attr_encrypted (>= 1.2)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activemodel (3.2
|
13
|
-
activesupport (= 3.2
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
method_source (0.
|
32
|
-
|
33
|
-
pg (
|
34
|
-
pry (0.
|
35
|
-
coderay (~> 1.
|
36
|
-
method_source (~> 0
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
rspec-
|
41
|
-
rspec-
|
42
|
-
|
43
|
-
|
44
|
-
rspec-expectations (
|
45
|
-
diff-lcs (>= 1.
|
46
|
-
|
47
|
-
|
48
|
-
|
12
|
+
activemodel (6.0.3.2)
|
13
|
+
activesupport (= 6.0.3.2)
|
14
|
+
activerecord (6.0.3.2)
|
15
|
+
activemodel (= 6.0.3.2)
|
16
|
+
activesupport (= 6.0.3.2)
|
17
|
+
activesupport (6.0.3.2)
|
18
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
19
|
+
i18n (>= 0.7, < 2)
|
20
|
+
minitest (~> 5.1)
|
21
|
+
tzinfo (~> 1.1)
|
22
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
23
|
+
attr_encrypted (3.1.0)
|
24
|
+
encryptor (~> 3.0.0)
|
25
|
+
coderay (1.1.3)
|
26
|
+
concurrent-ruby (1.1.6)
|
27
|
+
diff-lcs (1.4.4)
|
28
|
+
encryptor (3.0.0)
|
29
|
+
i18n (1.8.3)
|
30
|
+
concurrent-ruby (~> 1.0)
|
31
|
+
method_source (1.0.0)
|
32
|
+
minitest (5.14.1)
|
33
|
+
pg (1.2.3)
|
34
|
+
pry (0.13.1)
|
35
|
+
coderay (~> 1.1)
|
36
|
+
method_source (~> 1.0)
|
37
|
+
rake (13.0.1)
|
38
|
+
rspec (3.9.0)
|
39
|
+
rspec-core (~> 3.9.0)
|
40
|
+
rspec-expectations (~> 3.9.0)
|
41
|
+
rspec-mocks (~> 3.9.0)
|
42
|
+
rspec-core (3.9.2)
|
43
|
+
rspec-support (~> 3.9.3)
|
44
|
+
rspec-expectations (3.9.2)
|
45
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
+
rspec-support (~> 3.9.0)
|
47
|
+
rspec-mocks (3.9.1)
|
48
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
49
|
+
rspec-support (~> 3.9.0)
|
50
|
+
rspec-support (3.9.3)
|
51
|
+
thread_safe (0.3.6)
|
52
|
+
tzinfo (1.2.7)
|
53
|
+
thread_safe (~> 0.1)
|
54
|
+
zeitwerk (2.3.1)
|
49
55
|
|
50
56
|
PLATFORMS
|
51
57
|
ruby
|
52
58
|
|
53
59
|
DEPENDENCIES
|
54
60
|
attr_encrypted_pgcrypto!
|
55
|
-
pg (~>
|
61
|
+
pg (~> 1.2.3)
|
56
62
|
pry
|
57
63
|
rake
|
58
|
-
rspec (~>
|
64
|
+
rspec (~> 3.9.0)
|
65
|
+
|
66
|
+
BUNDLED WITH
|
67
|
+
2.1.4
|
data/README.md
CHANGED
@@ -74,10 +74,10 @@ Setup spec/database.yml and run `rake benchmark` to test the results on your own
|
|
74
74
|
|
75
75
|
Tested against:
|
76
76
|
|
77
|
-
- MRI Ruby
|
78
|
-
- Rails
|
79
|
-
- attr_encrypted 1.
|
80
|
-
- PostgreSQL
|
77
|
+
- MRI Ruby 2.7
|
78
|
+
- Rails 6
|
79
|
+
- attr_encrypted 3.1.0
|
80
|
+
- PostgreSQL 11.8
|
81
81
|
|
82
82
|
## Credits
|
83
83
|
|
data/app_container_name
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
attr_encrypted_pgcrypto
|
@@ -17,12 +17,12 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
|
-
gem.add_runtime_dependency 'attr_encrypted', '
|
20
|
+
gem.add_runtime_dependency 'attr_encrypted', '>= 1.2'
|
21
21
|
gem.add_runtime_dependency 'activerecord', '>= 3.0'
|
22
22
|
gem.add_runtime_dependency 'activesupport', '>= 3.0'
|
23
23
|
|
24
24
|
gem.add_development_dependency 'pry'
|
25
25
|
gem.add_development_dependency 'rake'
|
26
|
-
gem.add_development_dependency 'rspec', '~>
|
27
|
-
gem.add_development_dependency 'pg', '~>
|
26
|
+
gem.add_development_dependency 'rspec', '~> 3.9.0'
|
27
|
+
gem.add_development_dependency 'pg', '~> 1.2.3'
|
28
28
|
end
|
data/docker-compose.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
version: '2'
|
2
|
+
services:
|
3
|
+
ruby:
|
4
|
+
build:
|
5
|
+
context: .
|
6
|
+
dockerfile: docker/Dockerfile
|
7
|
+
volumes:
|
8
|
+
- .:/app:rw
|
9
|
+
container_name: attr_encrypted_pgcrypto
|
10
|
+
|
11
|
+
postgres:
|
12
|
+
image: postgres:11.8
|
13
|
+
ports:
|
14
|
+
- 5432:5432
|
15
|
+
env_file: ./docker/database-config
|
data/docker/Dockerfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
FROM ruby:2.7.1
|
2
|
+
|
3
|
+
# Install Ubuntu Dependencies
|
4
|
+
RUN apt-get update && apt-get install -y postgresql-client
|
5
|
+
|
6
|
+
ENV BUNDLER_VERSION='2.1.4'
|
7
|
+
RUN gem install bundler -v '2.1.4'
|
8
|
+
|
9
|
+
COPY docker/startup /usr/local/bin/startup
|
10
|
+
RUN chmod 755 /usr/local/bin/startup
|
11
|
+
|
12
|
+
WORKDIR /app
|
13
|
+
|
14
|
+
CMD "/usr/local/bin/startup"
|
data/docker/startup
ADDED
@@ -1,31 +1,20 @@
|
|
1
1
|
require 'active_record'
|
2
2
|
require 'active_record/log_subscriber'
|
3
|
-
require 'active_support/concern'
|
4
|
-
require 'active_support/lazy_load_hooks'
|
5
3
|
|
6
4
|
module AttrEncryptedPgcrypto
|
7
5
|
module LogSubscriber
|
8
6
|
module PostgresPgp
|
9
|
-
|
10
|
-
|
11
|
-
included do
|
12
|
-
alias_method_chain :sql, :postgres_pgp
|
13
|
-
end
|
14
|
-
|
15
|
-
# Public: Prevents sensitive data from being logged
|
16
|
-
def sql_with_postgres_pgp(event)
|
7
|
+
def sql(event)
|
17
8
|
filter = /(pgp_sym_(encrypt|decrypt))\(((.|\n)*?)\)/i
|
18
9
|
|
19
10
|
event.payload[:sql] = event.payload[:sql].gsub(filter) do |_|
|
20
11
|
"#{$1}([FILTERED])"
|
21
12
|
end
|
22
13
|
|
23
|
-
|
14
|
+
super
|
24
15
|
end
|
25
16
|
end
|
26
17
|
end
|
27
18
|
end
|
28
19
|
|
29
|
-
|
30
|
-
ActiveRecord::LogSubscriber.send :include, AttrEncryptedPgcrypto::LogSubscriber::PostgresPgp
|
31
|
-
end
|
20
|
+
ActiveRecord::LogSubscriber.send(:prepend, AttrEncryptedPgcrypto::LogSubscriber::PostgresPgp)
|
data/spec/default.database.yml
CHANGED
@@ -15,8 +15,8 @@ module AttrEncryptedPgcrypto::LogSubscriber
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it "filters pgp functions" do
|
18
|
-
expect(subject).to receive(:
|
19
|
-
event.payload[:sql].
|
18
|
+
expect(subject).to receive(:sql) do |event|
|
19
|
+
expect(event.payload[:sql]).to eq(output_query)
|
20
20
|
end
|
21
21
|
|
22
22
|
subject.sql(ActiveSupport::Notifications::Event.new(:sql, 1, 1, 1, { sql: output_query }))
|
data/spec/spec_helper.rb
CHANGED
@@ -11,7 +11,6 @@ Dir[SPEC_ROOT.join('support/*.rb')].each{|f| require f }
|
|
11
11
|
#
|
12
12
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
13
13
|
RSpec.configure do |config|
|
14
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
15
14
|
config.run_all_when_everything_filtered = true
|
16
15
|
config.filter_run :focus
|
17
16
|
|
@@ -21,15 +20,6 @@ RSpec.configure do |config|
|
|
21
20
|
# --seed 1234
|
22
21
|
config.order = 'random'
|
23
22
|
|
24
|
-
# When setting boolean tags/metadata, allow an array shorthand instead of hash
|
25
|
-
#
|
26
|
-
# Example
|
27
|
-
#
|
28
|
-
# it "wants my attention", :focus do
|
29
|
-
#
|
30
|
-
# https://www.relishapp.com/rspec/rspec-core/docs/metadata/user-defined-metadata
|
31
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
32
|
-
|
33
23
|
# https://www.relishapp.com/rspec/rspec-core/docs/filtering/run-all-when-everything-filtered
|
34
24
|
config.run_all_when_everything_filtered = true
|
35
25
|
end
|
metadata
CHANGED
@@ -1,113 +1,113 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attr_encrypted_pgcrypto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabe Martin-Dempesy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: attr_encrypted
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activerecord
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activesupport
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '3.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pry
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 3.9.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 3.9.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: pg
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 1.2.3
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 1.2.3
|
111
111
|
description: A pgcrypto based Encryptor implementation for attr_encrypted
|
112
112
|
email:
|
113
113
|
- gabe@mudbugmedia.com
|
@@ -115,15 +115,20 @@ executables: []
|
|
115
115
|
extensions: []
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
|
-
- .gitignore
|
119
|
-
- .rspec
|
120
|
-
- .travis.yml
|
118
|
+
- ".gitignore"
|
119
|
+
- ".rspec"
|
120
|
+
- ".travis.yml"
|
121
121
|
- Gemfile
|
122
122
|
- Gemfile.lock
|
123
123
|
- LICENSE.txt
|
124
124
|
- README.md
|
125
125
|
- Rakefile
|
126
|
+
- app_container_name
|
126
127
|
- attr_encrypted_pgcrypto.gemspec
|
128
|
+
- docker-compose.yml
|
129
|
+
- docker/Dockerfile
|
130
|
+
- docker/database-config
|
131
|
+
- docker/startup
|
127
132
|
- lib/attr_encrypted_pgcrypto.rb
|
128
133
|
- lib/attr_encrypted_pgcrypto/encryptor.rb
|
129
134
|
- lib/attr_encrypted_pgcrypto/log_subscriber/postgres_pgp.rb
|
@@ -142,17 +147,17 @@ require_paths:
|
|
142
147
|
- lib
|
143
148
|
required_ruby_version: !ruby/object:Gem::Requirement
|
144
149
|
requirements:
|
145
|
-
- -
|
150
|
+
- - ">="
|
146
151
|
- !ruby/object:Gem::Version
|
147
152
|
version: '0'
|
148
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
154
|
requirements:
|
150
|
-
- -
|
155
|
+
- - ">="
|
151
156
|
- !ruby/object:Gem::Version
|
152
157
|
version: '0'
|
153
158
|
requirements: []
|
154
159
|
rubyforge_project:
|
155
|
-
rubygems_version: 2.
|
160
|
+
rubygems_version: 2.4.8
|
156
161
|
signing_key:
|
157
162
|
specification_version: 4
|
158
163
|
summary: A pgcrypto based Encryptor implementation for attr_encrypted
|
@@ -162,4 +167,3 @@ test_files:
|
|
162
167
|
- spec/log_subscriber/postgres_pgp_spec.rb
|
163
168
|
- spec/spec_helper.rb
|
164
169
|
- spec/support/active_record.rb
|
165
|
-
has_rdoc:
|