crypt_keeper 2.0.0.rc2 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/crypt_keeper.gemspec +1 -1
- data/gemfiles/activerecord_4_2.gemfile +0 -1
- data/gemfiles/activerecord_5_0.gemfile +0 -1
- data/gemfiles/activerecord_5_1.gemfile +0 -1
- data/gemfiles/activerecord_5_2.gemfile +0 -1
- data/lib/crypt_keeper/provider/postgres_pgp.rb +8 -2
- data/lib/crypt_keeper/version.rb +1 -1
- data/spec/crypt_keeper/provider/postgres_pgp_spec.rb +36 -0
- metadata +14 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3487da836fa168664dc80667a7ec11cf0101b74724cc63d67ea47c67e46615e
|
4
|
+
data.tar.gz: 9bb8281e94f569254ff80c5e153a6291e8dbe0f40469a6e0fa2aeef058c745e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 422a52090724c857b26fafe9db634c736f1d21c66fb4a51d4516e76414f66a3f84205ef64b5e83facbb856c5dc1ee633f6827ced22144691edf43f24e79b8eb9
|
7
|
+
data.tar.gz: d90f464be5ef20b854fa144b40dff7f081608f3e6384176b1ab8b8efb867dd98651a8d6d7b9785a0f37ef4687f229c1679731dd2a3925f885eedeb92e58eec5a
|
data/.travis.yml
CHANGED
data/crypt_keeper.gemspec
CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |gem|
|
|
35
35
|
gem.add_development_dependency 'activerecord-jdbcpostgresql-adapter'
|
36
36
|
gem.add_development_dependency 'activerecord-jdbcmysql-adapter'
|
37
37
|
else
|
38
|
-
gem.add_development_dependency 'sqlite3'
|
38
|
+
gem.add_development_dependency 'sqlite3', '~> 1.3', '< 1.4'
|
39
39
|
gem.add_development_dependency 'pg', '~> 0.18.0'
|
40
40
|
gem.add_development_dependency 'mysql2', '>= 0.3.13', '< 0.6.0'
|
41
41
|
end
|
@@ -42,8 +42,14 @@ module CryptKeeper
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def search(records, field, criteria)
|
45
|
-
|
46
|
-
|
45
|
+
if criteria.present?
|
46
|
+
records
|
47
|
+
.where.not("TRIM(BOTH FROM #{field}) = ?", "")
|
48
|
+
.where("(pgp_sym_decrypt(cast(\"#{field}\" AS bytea), ?) = ?)",
|
49
|
+
key, criteria)
|
50
|
+
else
|
51
|
+
records.where(field => criteria)
|
52
|
+
end
|
47
53
|
end
|
48
54
|
|
49
55
|
private
|
data/lib/crypt_keeper/version.rb
CHANGED
@@ -64,6 +64,42 @@ describe CryptKeeper::Provider::PostgresPgp do
|
|
64
64
|
match = subject.create!(storage: 'blah')
|
65
65
|
expect(subject.search_by_plaintext(:storage, 'blah').first).to eq(match)
|
66
66
|
end
|
67
|
+
|
68
|
+
it "successfully accesses result when the data has empty strings and nil" do
|
69
|
+
subject.create!(storage: nil)
|
70
|
+
subject.create!(storage: '')
|
71
|
+
subject.create!(storage: ' ')
|
72
|
+
match = subject.create!(storage: 'blah')
|
73
|
+
|
74
|
+
results = subject.search_by_plaintext(:storage, 'blah')
|
75
|
+
|
76
|
+
expect(results).to match_array([match])
|
77
|
+
end
|
78
|
+
|
79
|
+
it "finds an empty string" do
|
80
|
+
subject.create!(storage: nil)
|
81
|
+
subject.create!(storage: 'blah')
|
82
|
+
match = subject.create!(storage: '')
|
83
|
+
|
84
|
+
expect(subject.search_by_plaintext(:storage, '')).to match_array([match])
|
85
|
+
end
|
86
|
+
|
87
|
+
it "finds the empty string with the right number of spaces" do
|
88
|
+
subject.create!(storage: '')
|
89
|
+
match = subject.create!(storage: ' ')
|
90
|
+
|
91
|
+
results = subject.search_by_plaintext(:storage, ' ')
|
92
|
+
|
93
|
+
expect(results).to match_array([match])
|
94
|
+
end
|
95
|
+
|
96
|
+
it "finds nil results" do
|
97
|
+
subject.create!(storage: '')
|
98
|
+
subject.create!(storage: 'blah')
|
99
|
+
match = subject.create!(storage: nil)
|
100
|
+
|
101
|
+
expect(subject.search_by_plaintext(:storage, nil)).to match_array([match])
|
102
|
+
end
|
67
103
|
end
|
68
104
|
|
69
105
|
describe "Custom pgcrypto options" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crypt_keeper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Mazzi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -152,16 +152,22 @@ dependencies:
|
|
152
152
|
name: sqlite3
|
153
153
|
requirement: !ruby/object:Gem::Requirement
|
154
154
|
requirements:
|
155
|
-
- - "
|
155
|
+
- - "~>"
|
156
156
|
- !ruby/object:Gem::Version
|
157
|
-
version: '
|
157
|
+
version: '1.3'
|
158
|
+
- - "<"
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '1.4'
|
158
161
|
type: :development
|
159
162
|
prerelease: false
|
160
163
|
version_requirements: !ruby/object:Gem::Requirement
|
161
164
|
requirements:
|
162
|
-
- - "
|
165
|
+
- - "~>"
|
163
166
|
- !ruby/object:Gem::Version
|
164
|
-
version: '
|
167
|
+
version: '1.3'
|
168
|
+
- - "<"
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '1.4'
|
165
171
|
- !ruby/object:Gem::Dependency
|
166
172
|
name: pg
|
167
173
|
requirement: !ruby/object:Gem::Requirement
|
@@ -261,9 +267,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
261
267
|
version: '0'
|
262
268
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
263
269
|
requirements:
|
264
|
-
- - "
|
270
|
+
- - ">="
|
265
271
|
- !ruby/object:Gem::Version
|
266
|
-
version:
|
272
|
+
version: '0'
|
267
273
|
requirements: []
|
268
274
|
rubyforge_project:
|
269
275
|
rubygems_version: 2.7.6
|