crypt_keeper 0.21.0 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/gemfiles/activerecord_4_1.gemfile.lock +2 -2
- data/gemfiles/activerecord_4_2.gemfile.lock +2 -2
- data/lib/crypt_keeper.rb +4 -1
- data/lib/crypt_keeper/log_subscriber/mysql_aes.rb +2 -0
- data/lib/crypt_keeper/log_subscriber/postgres_pgp.rb +2 -0
- data/lib/crypt_keeper/version.rb +1 -1
- data/spec/log_subscriber/mysql_aes_spec.rb +12 -0
- data/spec/log_subscriber/postgres_pgp_spec.rb +20 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3297d5e1a03266d6b1d74f5e9fee1fbba49dd295
|
4
|
+
data.tar.gz: f7621fbc63a9e94341105919bc839d8917d3f37b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2de5ef53aaa8f9d2e255f3c9b68c2996dae3eb2f49919ecceeb335fefbaaaa4ca98b1b0aa0ffb71aaf672ad2f7e0b6ed4edcbc721201f411cf6e8ba368984ab2
|
7
|
+
data.tar.gz: 82a701bd3b4c2a56394fdb205ecc0e24bb856028d0ccdbc61867ae0184b76967de02de7ddd07927fd00e16a6ad0d670f2d5442fc37ad408152ccc5eac900b574
|
data/lib/crypt_keeper.rb
CHANGED
@@ -13,7 +13,10 @@ require 'crypt_keeper/provider/postgres_pgp_public_key'
|
|
13
13
|
module CryptKeeper
|
14
14
|
class << self
|
15
15
|
attr_accessor :stub_encryption
|
16
|
-
alias_method :stub_encryption?, :stub_encryption
|
16
|
+
alias_method :stub_encryption?, :stub_encryption
|
17
|
+
|
18
|
+
attr_accessor :silence_logs
|
19
|
+
alias_method :silence_logs?, :silence_logs
|
17
20
|
end
|
18
21
|
end
|
19
22
|
|
@@ -16,6 +16,8 @@ module CryptKeeper
|
|
16
16
|
payload = event.payload[:sql]
|
17
17
|
.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
|
18
18
|
|
19
|
+
return if CryptKeeper.silence_logs? && payload =~ filter
|
20
|
+
|
19
21
|
event.payload[:sql] = payload.gsub(filter) do |_|
|
20
22
|
"#{$1}([FILTERED])"
|
21
23
|
end
|
@@ -16,6 +16,8 @@ module CryptKeeper
|
|
16
16
|
payload = event.payload[:sql]
|
17
17
|
.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
|
18
18
|
|
19
|
+
return if CryptKeeper.silence_logs? && payload =~ filter
|
20
|
+
|
19
21
|
event.payload[:sql] = payload.gsub(filter) do |_|
|
20
22
|
"#{$~[:operation]}([FILTERED])"
|
21
23
|
end
|
data/lib/crypt_keeper/version.rb
CHANGED
@@ -2,6 +2,10 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module CryptKeeper::LogSubscriber
|
4
4
|
describe MysqlAes do
|
5
|
+
before do
|
6
|
+
CryptKeeper.silence_logs = false
|
7
|
+
end
|
8
|
+
|
5
9
|
use_mysql
|
6
10
|
|
7
11
|
context "AES encryption" do
|
@@ -56,6 +60,14 @@ module CryptKeeper::LogSubscriber
|
|
56
60
|
string_encoding_query = "SELECT aes_encrypt('hi \255', 'test')"
|
57
61
|
subject.sql(ActiveSupport::Notifications::Event.new(:sql, 1, 1, 1, { sql: string_encoding_query }))
|
58
62
|
end
|
63
|
+
|
64
|
+
it "skips logging if CryptKeeper.silence_logs is set" do
|
65
|
+
CryptKeeper.silence_logs = true
|
66
|
+
|
67
|
+
subject.should_not_receive(:sql_without_mysql_aes)
|
68
|
+
|
69
|
+
subject.sql(ActiveSupport::Notifications::Event.new(:sql, 1, 1, 1, { sql: input_query }))
|
70
|
+
end
|
59
71
|
end
|
60
72
|
end
|
61
73
|
end
|
@@ -2,6 +2,10 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module CryptKeeper::LogSubscriber
|
4
4
|
describe PostgresPgp do
|
5
|
+
before do
|
6
|
+
CryptKeeper.silence_logs = false
|
7
|
+
end
|
8
|
+
|
5
9
|
use_postgres
|
6
10
|
|
7
11
|
context "Symmetric encryption" do
|
@@ -56,6 +60,14 @@ module CryptKeeper::LogSubscriber
|
|
56
60
|
string_encoding_query = "SELECT pgp_sym_encrypt('hi \255', 'test')"
|
57
61
|
subject.sql(ActiveSupport::Notifications::Event.new(:sql, 1, 1, 1, { sql: string_encoding_query }))
|
58
62
|
end
|
63
|
+
|
64
|
+
it "skips logging if CryptKeeper.silence_logs is set" do
|
65
|
+
CryptKeeper.silence_logs = true
|
66
|
+
|
67
|
+
subject.should_not_receive(:sql_without_postgres_pgp)
|
68
|
+
|
69
|
+
subject.sql(ActiveSupport::Notifications::Event.new(:sql, 1, 1, 1, { sql: input_query }))
|
70
|
+
end
|
59
71
|
end
|
60
72
|
|
61
73
|
context "Public key encryption" do
|
@@ -98,6 +110,14 @@ module CryptKeeper::LogSubscriber
|
|
98
110
|
|
99
111
|
subject.sql(ActiveSupport::Notifications::Event.new(:sql, 1, 1, 1, { sql: input_query.downcase }))
|
100
112
|
end
|
113
|
+
|
114
|
+
it "skips logging if CryptKeeper.silence_logs is set" do
|
115
|
+
CryptKeeper.silence_logs = true
|
116
|
+
|
117
|
+
subject.should_not_receive(:sql_without_postgres_pgp)
|
118
|
+
|
119
|
+
subject.sql(ActiveSupport::Notifications::Event.new(:sql, 1, 1, 1, { sql: input_query }))
|
120
|
+
end
|
101
121
|
end
|
102
122
|
end
|
103
123
|
end
|
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: 0.
|
4
|
+
version: 0.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Mazzi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|