pgdump_scrambler 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +123 -90
- data/lib/pgdump_scrambler/dumper.rb +10 -8
- data/lib/pgdump_scrambler/utils.rb +21 -0
- data/lib/pgdump_scrambler/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e7f5dfba9c232b88797b7bd41d467f2d78522df69c709923c8a37ad73258aa7
|
4
|
+
data.tar.gz: e4afb18633a51c9349af4182ea4c25f27b377d10c2b7c2b784dda45d942cec37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 182f6d023f2343404876af457a404b2e2c1c9410d951d8b1f68c1408861c42bd132db424ffe7fb292cbebaf78c7d355f83ecdb571c7cfa6f7d28c6c6b10cbe98
|
7
|
+
data.tar.gz: 79174375c3ae4f02a0d9b244d602fbba6258a8d8bfffe7be2e72c2939c25ae77e7acd73e074b1a60ce18519c3ad31562a74ba2dd2a68e47e38e671d34ad27370
|
data/CHANGELOG.md
CHANGED
@@ -1,13 +1,21 @@
|
|
1
|
+
## [0.5.0] - 2024-03-01
|
2
|
+
|
3
|
+
- Resolve ERB on loading config/database.yml
|
4
|
+
|
1
5
|
## [0.4.1] - 2023-10-19
|
6
|
+
|
2
7
|
- Fix S3 upload
|
3
8
|
|
4
9
|
## [0.4.0] - 2023-10-18
|
10
|
+
|
5
11
|
- Add scramble functions
|
6
12
|
- Support ARM64 Linux/Mac
|
7
13
|
|
8
14
|
## [0.3.0] - 2023-04-13
|
15
|
+
|
9
16
|
- Prefer using YAML.safe_load over YAML.load
|
10
17
|
- Test with Rails 7.0
|
11
18
|
|
12
19
|
### Fixes
|
20
|
+
|
13
21
|
- Fix JSON number format error
|
data/Gemfile.lock
CHANGED
@@ -1,165 +1,195 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pgdump_scrambler (0.
|
4
|
+
pgdump_scrambler (0.5.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
actioncable (7.
|
10
|
-
actionpack (= 7.
|
11
|
-
activesupport (= 7.
|
9
|
+
actioncable (7.1.1)
|
10
|
+
actionpack (= 7.1.1)
|
11
|
+
activesupport (= 7.1.1)
|
12
12
|
nio4r (~> 2.0)
|
13
13
|
websocket-driver (>= 0.6.1)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
zeitwerk (~> 2.6)
|
15
|
+
actionmailbox (7.1.1)
|
16
|
+
actionpack (= 7.1.1)
|
17
|
+
activejob (= 7.1.1)
|
18
|
+
activerecord (= 7.1.1)
|
19
|
+
activestorage (= 7.1.1)
|
20
|
+
activesupport (= 7.1.1)
|
20
21
|
mail (>= 2.7.1)
|
21
22
|
net-imap
|
22
23
|
net-pop
|
23
24
|
net-smtp
|
24
|
-
actionmailer (7.
|
25
|
-
actionpack (= 7.
|
26
|
-
actionview (= 7.
|
27
|
-
activejob (= 7.
|
28
|
-
activesupport (= 7.
|
25
|
+
actionmailer (7.1.1)
|
26
|
+
actionpack (= 7.1.1)
|
27
|
+
actionview (= 7.1.1)
|
28
|
+
activejob (= 7.1.1)
|
29
|
+
activesupport (= 7.1.1)
|
29
30
|
mail (~> 2.5, >= 2.5.4)
|
30
31
|
net-imap
|
31
32
|
net-pop
|
32
33
|
net-smtp
|
33
|
-
rails-dom-testing (~> 2.
|
34
|
-
actionpack (7.
|
35
|
-
actionview (= 7.
|
36
|
-
activesupport (= 7.
|
37
|
-
|
34
|
+
rails-dom-testing (~> 2.2)
|
35
|
+
actionpack (7.1.1)
|
36
|
+
actionview (= 7.1.1)
|
37
|
+
activesupport (= 7.1.1)
|
38
|
+
nokogiri (>= 1.8.5)
|
39
|
+
rack (>= 2.2.4)
|
40
|
+
rack-session (>= 1.0.1)
|
38
41
|
rack-test (>= 0.6.3)
|
39
|
-
rails-dom-testing (~> 2.
|
40
|
-
rails-html-sanitizer (~> 1.
|
41
|
-
actiontext (7.
|
42
|
-
actionpack (= 7.
|
43
|
-
activerecord (= 7.
|
44
|
-
activestorage (= 7.
|
45
|
-
activesupport (= 7.
|
42
|
+
rails-dom-testing (~> 2.2)
|
43
|
+
rails-html-sanitizer (~> 1.6)
|
44
|
+
actiontext (7.1.1)
|
45
|
+
actionpack (= 7.1.1)
|
46
|
+
activerecord (= 7.1.1)
|
47
|
+
activestorage (= 7.1.1)
|
48
|
+
activesupport (= 7.1.1)
|
46
49
|
globalid (>= 0.6.0)
|
47
50
|
nokogiri (>= 1.8.5)
|
48
|
-
actionview (7.
|
49
|
-
activesupport (= 7.
|
51
|
+
actionview (7.1.1)
|
52
|
+
activesupport (= 7.1.1)
|
50
53
|
builder (~> 3.1)
|
51
|
-
erubi (~> 1.
|
52
|
-
rails-dom-testing (~> 2.
|
53
|
-
rails-html-sanitizer (~> 1.
|
54
|
-
activejob (7.
|
55
|
-
activesupport (= 7.
|
54
|
+
erubi (~> 1.11)
|
55
|
+
rails-dom-testing (~> 2.2)
|
56
|
+
rails-html-sanitizer (~> 1.6)
|
57
|
+
activejob (7.1.1)
|
58
|
+
activesupport (= 7.1.1)
|
56
59
|
globalid (>= 0.3.6)
|
57
|
-
activemodel (7.
|
58
|
-
activesupport (= 7.
|
59
|
-
activerecord (7.
|
60
|
-
activemodel (= 7.
|
61
|
-
activesupport (= 7.
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
60
|
+
activemodel (7.1.1)
|
61
|
+
activesupport (= 7.1.1)
|
62
|
+
activerecord (7.1.1)
|
63
|
+
activemodel (= 7.1.1)
|
64
|
+
activesupport (= 7.1.1)
|
65
|
+
timeout (>= 0.4.0)
|
66
|
+
activestorage (7.1.1)
|
67
|
+
actionpack (= 7.1.1)
|
68
|
+
activejob (= 7.1.1)
|
69
|
+
activerecord (= 7.1.1)
|
70
|
+
activesupport (= 7.1.1)
|
67
71
|
marcel (~> 1.0)
|
68
|
-
|
69
|
-
|
72
|
+
activesupport (7.1.1)
|
73
|
+
base64
|
74
|
+
bigdecimal
|
70
75
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
76
|
+
connection_pool (>= 2.2.5)
|
77
|
+
drb
|
71
78
|
i18n (>= 1.6, < 2)
|
72
79
|
minitest (>= 5.1)
|
80
|
+
mutex_m
|
73
81
|
tzinfo (~> 2.0)
|
74
82
|
ast (2.4.2)
|
75
83
|
base64 (0.1.1)
|
84
|
+
bigdecimal (3.1.4)
|
76
85
|
builder (3.2.4)
|
77
86
|
concurrent-ruby (1.2.2)
|
87
|
+
connection_pool (2.4.1)
|
78
88
|
crass (1.0.6)
|
79
89
|
date (3.3.3)
|
80
90
|
diff-lcs (1.5.0)
|
91
|
+
drb (2.1.1)
|
92
|
+
ruby2_keywords
|
81
93
|
erubi (1.12.0)
|
82
|
-
globalid (1.1
|
83
|
-
activesupport (>=
|
84
|
-
i18n (1.
|
94
|
+
globalid (1.2.1)
|
95
|
+
activesupport (>= 6.1)
|
96
|
+
i18n (1.14.1)
|
85
97
|
concurrent-ruby (~> 1.0)
|
98
|
+
io-console (0.6.0)
|
99
|
+
irb (1.8.3)
|
100
|
+
rdoc
|
101
|
+
reline (>= 0.3.8)
|
86
102
|
json (2.6.3)
|
87
103
|
language_server-protocol (3.17.0.3)
|
88
|
-
loofah (2.
|
104
|
+
loofah (2.21.4)
|
89
105
|
crass (~> 1.0.2)
|
90
|
-
nokogiri (>= 1.
|
106
|
+
nokogiri (>= 1.12.0)
|
91
107
|
mail (2.8.1)
|
92
108
|
mini_mime (>= 0.1.1)
|
93
109
|
net-imap
|
94
110
|
net-pop
|
95
111
|
net-smtp
|
96
112
|
marcel (1.0.2)
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
net-imap (0.
|
113
|
+
mini_mime (1.1.5)
|
114
|
+
minitest (5.20.0)
|
115
|
+
mutex_m (0.1.2)
|
116
|
+
net-imap (0.4.1)
|
101
117
|
date
|
102
118
|
net-protocol
|
103
119
|
net-pop (0.1.2)
|
104
120
|
net-protocol
|
105
121
|
net-protocol (0.2.1)
|
106
122
|
timeout
|
107
|
-
net-smtp (0.
|
123
|
+
net-smtp (0.4.0)
|
108
124
|
net-protocol
|
109
125
|
nio4r (2.5.9)
|
110
|
-
nokogiri (1.
|
126
|
+
nokogiri (1.15.4-x86_64-linux)
|
111
127
|
racc (~> 1.4)
|
112
128
|
parallel (1.23.0)
|
113
129
|
parser (3.2.2.4)
|
114
130
|
ast (~> 2.4.1)
|
115
131
|
racc
|
116
|
-
|
117
|
-
|
132
|
+
psych (5.1.1.1)
|
133
|
+
stringio
|
134
|
+
racc (1.7.1)
|
135
|
+
rack (3.0.8)
|
136
|
+
rack-session (2.0.0)
|
137
|
+
rack (>= 3.0.0)
|
118
138
|
rack-test (2.1.0)
|
119
139
|
rack (>= 1.3)
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
140
|
+
rackup (2.1.0)
|
141
|
+
rack (>= 3)
|
142
|
+
webrick (~> 1.8)
|
143
|
+
rails (7.1.1)
|
144
|
+
actioncable (= 7.1.1)
|
145
|
+
actionmailbox (= 7.1.1)
|
146
|
+
actionmailer (= 7.1.1)
|
147
|
+
actionpack (= 7.1.1)
|
148
|
+
actiontext (= 7.1.1)
|
149
|
+
actionview (= 7.1.1)
|
150
|
+
activejob (= 7.1.1)
|
151
|
+
activemodel (= 7.1.1)
|
152
|
+
activerecord (= 7.1.1)
|
153
|
+
activestorage (= 7.1.1)
|
154
|
+
activesupport (= 7.1.1)
|
132
155
|
bundler (>= 1.15.0)
|
133
|
-
railties (= 7.
|
134
|
-
rails-dom-testing (2.0
|
135
|
-
activesupport (>=
|
156
|
+
railties (= 7.1.1)
|
157
|
+
rails-dom-testing (2.2.0)
|
158
|
+
activesupport (>= 5.0.0)
|
159
|
+
minitest
|
136
160
|
nokogiri (>= 1.6)
|
137
|
-
rails-html-sanitizer (1.
|
138
|
-
loofah (~> 2.
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
161
|
+
rails-html-sanitizer (1.6.0)
|
162
|
+
loofah (~> 2.21)
|
163
|
+
nokogiri (~> 1.14)
|
164
|
+
railties (7.1.1)
|
165
|
+
actionpack (= 7.1.1)
|
166
|
+
activesupport (= 7.1.1)
|
167
|
+
irb
|
168
|
+
rackup (>= 1.0.0)
|
143
169
|
rake (>= 12.2)
|
144
|
-
thor (~> 1.0)
|
145
|
-
zeitwerk (~> 2.
|
170
|
+
thor (~> 1.0, >= 1.2.2)
|
171
|
+
zeitwerk (~> 2.6)
|
146
172
|
rainbow (3.1.1)
|
147
173
|
rake (13.0.6)
|
174
|
+
rdoc (6.5.0)
|
175
|
+
psych (>= 4.0.0)
|
148
176
|
regexp_parser (2.8.2)
|
177
|
+
reline (0.3.9)
|
178
|
+
io-console (~> 0.5)
|
149
179
|
rexml (3.2.6)
|
150
180
|
rspec (3.12.0)
|
151
181
|
rspec-core (~> 3.12.0)
|
152
182
|
rspec-expectations (~> 3.12.0)
|
153
183
|
rspec-mocks (~> 3.12.0)
|
154
|
-
rspec-core (3.12.
|
184
|
+
rspec-core (3.12.2)
|
155
185
|
rspec-support (~> 3.12.0)
|
156
|
-
rspec-expectations (3.12.
|
186
|
+
rspec-expectations (3.12.3)
|
157
187
|
diff-lcs (>= 1.2.0, < 2.0)
|
158
188
|
rspec-support (~> 3.12.0)
|
159
|
-
rspec-mocks (3.12.
|
189
|
+
rspec-mocks (3.12.6)
|
160
190
|
diff-lcs (>= 1.2.0, < 2.0)
|
161
191
|
rspec-support (~> 3.12.0)
|
162
|
-
rspec-support (3.12.
|
192
|
+
rspec-support (3.12.1)
|
163
193
|
rubocop (1.57.1)
|
164
194
|
base64 (~> 0.1.1)
|
165
195
|
json (~> 2.3)
|
@@ -183,15 +213,18 @@ GEM
|
|
183
213
|
rubocop-capybara (~> 2.17)
|
184
214
|
rubocop-factory_bot (~> 2.22)
|
185
215
|
ruby-progressbar (1.13.0)
|
186
|
-
|
187
|
-
|
216
|
+
ruby2_keywords (0.0.5)
|
217
|
+
stringio (3.0.8)
|
218
|
+
thor (1.3.0)
|
219
|
+
timeout (0.4.0)
|
188
220
|
tzinfo (2.0.6)
|
189
221
|
concurrent-ruby (~> 1.0)
|
190
222
|
unicode-display_width (2.5.0)
|
191
|
-
|
223
|
+
webrick (1.8.1)
|
224
|
+
websocket-driver (0.7.6)
|
192
225
|
websocket-extensions (>= 0.1.0)
|
193
226
|
websocket-extensions (0.1.5)
|
194
|
-
zeitwerk (2.6.
|
227
|
+
zeitwerk (2.6.12)
|
195
228
|
|
196
229
|
PLATFORMS
|
197
230
|
x86_64-linux
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'pgdump_scrambler/utils'
|
3
4
|
require 'open3'
|
5
|
+
|
4
6
|
module PgdumpScrambler
|
5
7
|
class Dumper
|
6
8
|
def initialize(config, db_config = {})
|
@@ -12,13 +14,19 @@ module PgdumpScrambler
|
|
12
14
|
def run
|
13
15
|
puts 'Executing pg_dump...'
|
14
16
|
puts full_command
|
15
|
-
raise 'pg_dump failed!' unless system(full_command)
|
17
|
+
raise 'pg_dump failed!' unless system(env_vars, full_command)
|
16
18
|
|
17
19
|
puts 'Done!'
|
18
20
|
end
|
19
21
|
|
20
22
|
private
|
21
23
|
|
24
|
+
def env_vars
|
25
|
+
vars = {}
|
26
|
+
vars['PGPASSWORD'] = @db_config['password'] if @db_config['password']
|
27
|
+
vars
|
28
|
+
end
|
29
|
+
|
22
30
|
def full_command
|
23
31
|
[pgdump_command, obfuscator_command, 'gzip -c'].compact.join(' | ') + "> #{@output_path}"
|
24
32
|
end
|
@@ -32,7 +40,6 @@ module PgdumpScrambler
|
|
32
40
|
|
33
41
|
def pgdump_command
|
34
42
|
command = []
|
35
|
-
command << "PGPASSWORD=#{Shellwords.escape(@db_config['password'])}" if @db_config['password']
|
36
43
|
command << 'pg_dump'
|
37
44
|
command << @config.pgdump_args if @config.pgdump_args
|
38
45
|
command << "--username=#{Shellwords.escape(@db_config['username'])}" if @db_config['username']
|
@@ -50,12 +57,7 @@ module PgdumpScrambler
|
|
50
57
|
def load_database_yml
|
51
58
|
return unless defined?(Rails)
|
52
59
|
|
53
|
-
db_config =
|
54
|
-
Rails.root.join('config', 'database.yml'),
|
55
|
-
permitted_classes: [],
|
56
|
-
permitted_symbols: [],
|
57
|
-
aliases: true
|
58
|
-
)
|
60
|
+
db_config = Utils.load_yaml_with_erb(Rails.root.join('config', 'database.yml'))
|
59
61
|
db_config[Rails.env]
|
60
62
|
end
|
61
63
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
require 'erb'
|
5
|
+
|
6
|
+
module PgdumpScrambler
|
7
|
+
module Utils
|
8
|
+
module_function
|
9
|
+
|
10
|
+
def load_yaml_with_erb(path)
|
11
|
+
yaml_content = File.read(path)
|
12
|
+
resolved = ERB.new(yaml_content).result
|
13
|
+
YAML.safe_load(
|
14
|
+
resolved,
|
15
|
+
permitted_classes: [],
|
16
|
+
permitted_symbols: [],
|
17
|
+
aliases: true
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pgdump_scrambler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shunichi Ikegami
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Scramble pg_dump columns.
|
14
14
|
email:
|
@@ -38,6 +38,7 @@ files:
|
|
38
38
|
- lib/pgdump_scrambler/railtie.rb
|
39
39
|
- lib/pgdump_scrambler/s3_request.rb
|
40
40
|
- lib/pgdump_scrambler/s3_uploader.rb
|
41
|
+
- lib/pgdump_scrambler/utils.rb
|
41
42
|
- lib/pgdump_scrambler/version.rb
|
42
43
|
- lib/tasks/pgdump_scrambler_tasks.rake
|
43
44
|
- libexec/pgdump-obfuscator-darwin-amd64
|
@@ -68,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
69
|
- !ruby/object:Gem::Version
|
69
70
|
version: '0'
|
70
71
|
requirements: []
|
71
|
-
rubygems_version: 3.
|
72
|
+
rubygems_version: 3.2.33
|
72
73
|
signing_key:
|
73
74
|
specification_version: 4
|
74
75
|
summary: Scramble pg_dump columns
|