data-anonymization 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -1
- data/.rvmrc +1 -1
- data/.travis.yml +2 -0
- data/Gemfile +2 -0
- data/README.md +295 -258
- data/bin/datanon +57 -0
- data/data-anonymization.gemspec +2 -1
- data/examples/blacklist_dsl.rb +42 -0
- data/examples/mongodb_blacklist_dsl.rb +38 -0
- data/examples/mongodb_whitelist_dsl.rb +44 -0
- data/examples/whitelist_dsl.rb +63 -0
- data/lib/core/database.rb +21 -3
- data/lib/core/field.rb +5 -2
- data/lib/core/fields_missing_strategy.rb +30 -0
- data/lib/core/table_errors.rb +32 -0
- data/lib/data-anonymization.rb +11 -0
- data/lib/parallel/table.rb +8 -1
- data/lib/strategy/base.rb +35 -14
- data/lib/strategy/blacklist.rb +1 -1
- data/lib/strategy/field/anonymize_array.rb +28 -0
- data/lib/strategy/field/contact/random_address.rb +12 -0
- data/lib/strategy/field/contact/random_city.rb +12 -0
- data/lib/strategy/field/contact/random_phone_number.rb +4 -0
- data/lib/strategy/field/contact/random_province.rb +12 -0
- data/lib/strategy/field/contact/random_zipcode.rb +12 -0
- data/lib/strategy/field/datetime/anonymize_date.rb +15 -0
- data/lib/strategy/field/datetime/anonymize_datetime.rb +19 -0
- data/lib/strategy/field/datetime/anonymize_time.rb +19 -0
- data/lib/strategy/field/datetime/date_delta.rb +10 -0
- data/lib/strategy/field/datetime/date_time_delta.rb +9 -0
- data/lib/strategy/field/datetime/time_delta.rb +8 -0
- data/lib/strategy/field/default_anon.rb +4 -1
- data/lib/strategy/field/email/gmail_template.rb +8 -0
- data/lib/strategy/field/email/random_email.rb +7 -0
- data/lib/strategy/field/email/random_mailinator_email.rb +5 -0
- data/lib/strategy/field/fields.rb +4 -0
- data/lib/strategy/field/name/random_first_name.rb +10 -0
- data/lib/strategy/field/name/random_full_name.rb +10 -2
- data/lib/strategy/field/name/random_last_name.rb +9 -0
- data/lib/strategy/field/name/random_user_name.rb +5 -0
- data/lib/strategy/field/number/random_big_decimal_delta.rb +6 -0
- data/lib/strategy/field/number/random_float.rb +4 -0
- data/lib/strategy/field/number/random_float_delta.rb +6 -0
- data/lib/strategy/field/number/random_integer.rb +4 -0
- data/lib/strategy/field/number/random_integer_delta.rb +6 -0
- data/lib/strategy/field/string/formatted_string_numbers.rb +10 -6
- data/lib/strategy/field/string/lorem_ipsum.rb +9 -0
- data/lib/strategy/field/string/random_formatted_string.rb +39 -0
- data/lib/strategy/field/string/random_string.rb +6 -0
- data/lib/strategy/field/string/random_url.rb +7 -1
- data/lib/strategy/field/string/select_from_database.rb +7 -5
- data/lib/strategy/field/string/select_from_file.rb +7 -0
- data/lib/strategy/field/string/select_from_list.rb +8 -0
- data/lib/strategy/field/string/string_template.rb +11 -0
- data/lib/strategy/mongodb/anonymize_field.rb +44 -0
- data/lib/strategy/mongodb/blacklist.rb +29 -0
- data/lib/strategy/mongodb/whitelist.rb +62 -0
- data/lib/strategy/strategies.rb +10 -1
- data/lib/strategy/whitelist.rb +7 -2
- data/lib/thor/helpers/mongodb_dsl_generator.rb +66 -0
- data/lib/thor/helpers/rdbms_dsl_generator.rb +36 -0
- data/lib/thor/templates/mongodb_whitelist_template.erb +15 -0
- data/lib/thor/templates/whitelist_template.erb +21 -0
- data/lib/utils/database.rb +4 -0
- data/lib/utils/parallel_progress_bar.rb +24 -0
- data/lib/utils/progress_bar.rb +34 -22
- data/lib/utils/random_string.rb +3 -2
- data/lib/utils/random_string_chars_only.rb +3 -5
- data/lib/utils/template_helper.rb +44 -0
- data/lib/version.rb +1 -1
- data/spec/acceptance/mongodb_blacklist_spec.rb +75 -0
- data/spec/acceptance/mongodb_whitelist_spec.rb +107 -0
- data/spec/core/fields_missing_strategy_spec.rb +26 -0
- data/spec/strategy/field/name/random_first_name_spec.rb +1 -1
- data/spec/strategy/field/name/random_full_name_spec.rb +12 -7
- data/spec/strategy/field/name/random_last_name_spec.rb +1 -1
- data/spec/strategy/field/string/random_formatted_string_spec.rb +39 -0
- data/spec/strategy/field/string/select_from_file_spec.rb +21 -0
- data/spec/strategy/mongodb/anonymize_field_spec.rb +52 -0
- data/spec/utils/random_float_spec.rb +12 -0
- data/spec/utils/random_string_char_only_spec.rb +12 -0
- data/spec/utils/template_helper_spec.rb +14 -0
- metadata +56 -6
- data/blacklist_dsl.rb +0 -17
- data/blacklist_nosql_dsl.rb +0 -36
- data/whitelist_dsl.rb +0 -42
@@ -0,0 +1,26 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe DataAnon::Core::FieldsMissingStrategy do
|
4
|
+
|
5
|
+
FMS = DataAnon::Core::FieldsMissingStrategy
|
6
|
+
|
7
|
+
it "should be able to add field for new table that doesn't exist" do
|
8
|
+
users = FMS.new("users")
|
9
|
+
users.missing("confirm_email")
|
10
|
+
users.fields_missing_strategy.should == ["confirm_email"]
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should be able to take care for same field appearing multiple time" do
|
14
|
+
users = FMS.new("users")
|
15
|
+
users.missing("confirm_email")
|
16
|
+
users.missing("confirm_email")
|
17
|
+
users.fields_missing_strategy.should == ["confirm_email"]
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should be able to add multiple fields for table" do
|
21
|
+
users = FMS.new("users")
|
22
|
+
users.missing("confirm_email")
|
23
|
+
users.missing("password_reset")
|
24
|
+
users.fields_missing_strategy.should == ["confirm_email","password_reset"]
|
25
|
+
end
|
26
|
+
end
|
@@ -6,7 +6,7 @@ describe FieldStrategy::RandomFirstName do
|
|
6
6
|
let(:field) {DataAnon::Core::Field.new('firstname','fakeFirstName',1,nil)}
|
7
7
|
|
8
8
|
describe 'anonymized name must not be the same as provided name' do
|
9
|
-
let(:anonymized_value) {RandomFirstName.new().anonymize(field
|
9
|
+
let(:anonymized_value) {RandomFirstName.new().anonymize(field)}
|
10
10
|
|
11
11
|
it {anonymized_value.should_not equal field.value}
|
12
12
|
end
|
@@ -3,21 +3,26 @@ require "spec_helper"
|
|
3
3
|
describe FieldStrategy::RandomFullName do
|
4
4
|
|
5
5
|
RandomFullName = FieldStrategy::RandomFullName
|
6
|
-
let(:field) {DataAnon::Core::Field.new('name','Fake User',1,nil)}
|
7
6
|
|
8
|
-
describe 'anonymized name
|
7
|
+
describe 'anonymized name with just single name' do
|
8
|
+
let(:field) {DataAnon::Core::Field.new('name','Fake',1,nil)}
|
9
|
+
let(:anonymized_value) {RandomFullName.new().anonymize(field)}
|
9
10
|
|
10
|
-
|
11
|
+
it {anonymized_value.should_not equal field.value}
|
12
|
+
end
|
11
13
|
|
12
|
-
|
14
|
+
describe 'anonymized name should be the same as original' do
|
15
|
+
let(:field) {DataAnon::Core::Field.new('name','Fake User',1,nil)}
|
16
|
+
let(:anonymized_value) {RandomFullName.new().anonymize(field)}
|
17
|
+
|
18
|
+
it {anonymized_value.should_not equal field.value}
|
13
19
|
end
|
14
20
|
|
15
21
|
describe 'anonymized name should have same number of words as original' do
|
16
|
-
|
17
22
|
let(:field) {DataAnon::Core::Field.new('name','Fake User Longer Name Test',1,nil)}
|
18
|
-
let(:
|
23
|
+
let(:anonymized_value) {RandomFullName.new().anonymize(field)}
|
19
24
|
|
20
|
-
it {
|
25
|
+
it {anonymized_value.split(' ').size.should equal 5}
|
21
26
|
end
|
22
27
|
|
23
28
|
end
|
@@ -6,7 +6,7 @@ describe FieldStrategy::RandomLastName do
|
|
6
6
|
let(:field) {DataAnon::Core::Field.new('lastname','fakeLastName',1,nil)}
|
7
7
|
|
8
8
|
describe 'anonymized name must not be the same as provided name' do
|
9
|
-
let(:anonymized_value) {RandomLastName.new().anonymize(field
|
9
|
+
let(:anonymized_value) {RandomLastName.new().anonymize(field)}
|
10
10
|
|
11
11
|
it {anonymized_value.should_not equal field.value}
|
12
12
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe FieldStrategy::RandomFormattedString do
|
4
|
+
|
5
|
+
RandomFormattedString = FieldStrategy::RandomFormattedString
|
6
|
+
|
7
|
+
describe 'anonymized credit card number preserving the format' do
|
8
|
+
let(:field) {DataAnon::Core::Field.new('credit_card_number',"1111-2222-3333-4444",1,nil)}
|
9
|
+
let(:anonymized_value) {RandomFormattedString.new.anonymize(field)}
|
10
|
+
|
11
|
+
it {anonymized_value.should_not equal field.value}
|
12
|
+
it { anonymized_value.should match /^\d{4}-\d{4}-\d{4}-\d{4}$/}
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'anonymized email preserving the format' do
|
16
|
+
let(:field) {DataAnon::Core::Field.new('email',"parekh1.sunit@gmail.com",1,nil)}
|
17
|
+
let(:anonymized_value) {RandomFormattedString.new.anonymize(field)}
|
18
|
+
|
19
|
+
it {anonymized_value.should_not equal field.value}
|
20
|
+
it { anonymized_value.should match /^[a-z]{6}\d\.[a-z]{5}@[a-z]{5}\.[a-z]{3}$/}
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'anonymized string preserving the string case & format' do
|
24
|
+
let(:field) {DataAnon::Core::Field.new('email',"parekh1.SUNIT@gmail.com",1,nil)}
|
25
|
+
let(:anonymized_value) {RandomFormattedString.new.anonymize(field)}
|
26
|
+
|
27
|
+
it {anonymized_value.should_not equal field.value}
|
28
|
+
it { anonymized_value.should match /^[a-z]{6}\d\.[A-Z]{5}@[a-z]{5}\.[a-z]{3}$/}
|
29
|
+
end
|
30
|
+
|
31
|
+
describe 'anonymized phone# preserving the format' do
|
32
|
+
let(:field) {DataAnon::Core::Field.new('home_phone',"(020)3423-8013",1,nil)}
|
33
|
+
let(:anonymized_value) {RandomFormattedString.new.anonymize(field)}
|
34
|
+
|
35
|
+
it {anonymized_value.should_not equal field.value}
|
36
|
+
it { anonymized_value.should match /^\(\d{3}\)\d{4}-\d{4}$/}
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe FieldStrategy::SelectFromFile do
|
4
|
+
|
5
|
+
SelectFromFile = FieldStrategy::SelectFromFile
|
6
|
+
|
7
|
+
describe 'anonymized name must not be the same as provided name' do
|
8
|
+
let(:field) {DataAnon::Core::Field.new('firstname','fakeFirstName',1,nil)}
|
9
|
+
let(:anonymized_value) {SelectFromFile.new(DataAnon::Utils::Resource.file('first_names.txt')).anonymize(field)}
|
10
|
+
|
11
|
+
it {anonymized_value.should_not equal field.value}
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'anonymized multiple values' do
|
15
|
+
let(:field) {DataAnon::Core::Field.new('firstname',['value1','value2'],1,nil)}
|
16
|
+
let(:anonymized_values) {SelectFromFile.new(DataAnon::Utils::Resource.file('first_names.txt')).anonymize(field)}
|
17
|
+
|
18
|
+
it {anonymized_values.length.should equal 2}
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe DataAnon::Strategy::MongoDB::AnonymizeField do
|
4
|
+
|
5
|
+
|
6
|
+
it 'should do callback recursive in case of sub document' do
|
7
|
+
sub_document = {'key' => 'value'}
|
8
|
+
field_strategy = {'key' => FieldStrategy::LoremIpsum.new}
|
9
|
+
anonymization_strategy = mock("AnonymizationStrategy")
|
10
|
+
anonymization_strategy.should_receive(:anonymize_document).with(sub_document,1,field_strategy).and_return({'key' => "anonymized_value"})
|
11
|
+
field = DataAnon::Core::Field.new('sub_document_field', sub_document,1,nil)
|
12
|
+
anonymize_field = DataAnon::Strategy::MongoDB::AnonymizeField.new(field, field_strategy,anonymization_strategy)
|
13
|
+
anonymized_value = anonymize_field.anonymize
|
14
|
+
anonymized_value['key'].should == "anonymized_value"
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should do callback recursive multiple time in case of array of sub document' do
|
18
|
+
sub_documents = [{'key' => 'value1'},{'key' => 'value2'}]
|
19
|
+
field_strategy = {'key' => FieldStrategy::LoremIpsum.new}
|
20
|
+
anonymization_strategy = mock("AnonymizationStrategy")
|
21
|
+
anonymization_strategy.should_receive(:anonymize_document).with({'key' => 'value1'},1,field_strategy).and_return({'key' => "anonymized_value1"})
|
22
|
+
anonymization_strategy.should_receive(:anonymize_document).with({'key' => 'value2'},1,field_strategy).and_return({'key' => "anonymized_value2"})
|
23
|
+
field = DataAnon::Core::Field.new('sub_document_field', sub_documents,1,nil)
|
24
|
+
anonymize_field = DataAnon::Strategy::MongoDB::AnonymizeField.new(field, field_strategy,anonymization_strategy)
|
25
|
+
anonymized_value = anonymize_field.anonymize
|
26
|
+
anonymized_value.length.should == 2
|
27
|
+
anonymized_value[0]['key'].should == "anonymized_value1"
|
28
|
+
anonymized_value[1]['key'].should == "anonymized_value2"
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should anonymize array field data type' do
|
32
|
+
anonymization_strategy = mock("AnonymizationStrategy")
|
33
|
+
anonymization_strategy.should_not_receive(:anonymize_document)
|
34
|
+
field = DataAnon::Core::Field.new('tags',['tag1','tag2'],1,nil)
|
35
|
+
anonymize_field = DataAnon::Strategy::MongoDB::AnonymizeField.new(field,FieldStrategy::SelectFromList.new(['tag4','tag5','tag6','tag7','tag8']),anonymization_strategy)
|
36
|
+
anonymized_value = anonymize_field.anonymize
|
37
|
+
anonymized_value.length == 2
|
38
|
+
['tag4','tag5','tag6','tag7','tag8'].should include(anonymized_value[0])
|
39
|
+
['tag4','tag5','tag6','tag7','tag8'].should include(anonymized_value[1])
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should anonymize field and return anonymized value using passed strategy' do
|
43
|
+
anonymization_strategy = mock("AnonymizationStrategy")
|
44
|
+
anonymization_strategy.should_not_receive(:anonymize_document)
|
45
|
+
field = DataAnon::Core::Field.new('boolean_field',false,1,nil)
|
46
|
+
anonymize_field = DataAnon::Strategy::MongoDB::AnonymizeField.new(field,FieldStrategy::RandomBoolean.new,anonymization_strategy)
|
47
|
+
anonymized_value = anonymize_field.anonymize
|
48
|
+
[true, false].should include(anonymized_value)
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "Number Utils" do
|
4
|
+
|
5
|
+
describe 'should return same length value using default text' do
|
6
|
+
|
7
|
+
let(:random_float) { DataAnon::Utils::RandomFloat.generate(5,10) }
|
8
|
+
|
9
|
+
it { random_float.should be_between(5,10) }
|
10
|
+
it { random_float.should be_a_kind_of Float }
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "String Utils" do
|
4
|
+
|
5
|
+
it "should generate random string of given length" do
|
6
|
+
DataAnon::Utils::RandomStringCharsOnly.generate(10).length.should equal 10
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should generate random string only with characters" do
|
10
|
+
DataAnon::Utils::RandomStringCharsOnly.generate(10).should match /^[a-zA-Z]{10}$/
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "Template Helper" do
|
4
|
+
|
5
|
+
it "should return a correctly formatted string based on input connection hash for source" do
|
6
|
+
connection_hash = {:adapter => "test_adapter", :port => 5000}
|
7
|
+
DataAnon::Utils::TemplateHelper.source_connection_specs_rdbms(connection_hash).should eq(":adapter => 'test_adapter', :port => 5000")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should return a correctly formatted string based on input connection hash for destination" do
|
11
|
+
connection_hash = {:adapter => "test_adapter", :port => 5000}
|
12
|
+
DataAnon::Utils::TemplateHelper.destination_connection_specs_rdbms(connection_hash).should eq(":adapter => '<enter_value>', :port => '<enter_value>'")
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data-anonymization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-09-
|
14
|
+
date: 2012-09-28 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activerecord
|
@@ -125,12 +125,29 @@ dependencies:
|
|
125
125
|
- - ~>
|
126
126
|
- !ruby/object:Gem::Version
|
127
127
|
version: 0.5.18
|
128
|
+
- !ruby/object:Gem::Dependency
|
129
|
+
name: thor
|
130
|
+
requirement: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
132
|
+
requirements:
|
133
|
+
- - ~>
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: 0.16.0
|
136
|
+
type: :runtime
|
137
|
+
prerelease: false
|
138
|
+
version_requirements: !ruby/object:Gem::Requirement
|
139
|
+
none: false
|
140
|
+
requirements:
|
141
|
+
- - ~>
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: 0.16.0
|
128
144
|
description: Data anonymization tool for RDBMS databases
|
129
145
|
email:
|
130
146
|
- parekh.sunit@gmail.com
|
131
147
|
- anand.agrawal84@gmail.com
|
132
148
|
- satyamag@gmail.com
|
133
|
-
executables:
|
149
|
+
executables:
|
150
|
+
- datanon
|
134
151
|
extensions: []
|
135
152
|
extra_rdoc_files: []
|
136
153
|
files:
|
@@ -143,16 +160,22 @@ files:
|
|
143
160
|
- LICENSE.txt
|
144
161
|
- README.md
|
145
162
|
- Rakefile
|
146
|
-
-
|
147
|
-
- blacklist_nosql_dsl.rb
|
163
|
+
- bin/datanon
|
148
164
|
- data-anonymization.gemspec
|
165
|
+
- examples/blacklist_dsl.rb
|
166
|
+
- examples/mongodb_blacklist_dsl.rb
|
167
|
+
- examples/mongodb_whitelist_dsl.rb
|
168
|
+
- examples/whitelist_dsl.rb
|
149
169
|
- lib/core/database.rb
|
150
170
|
- lib/core/dsl.rb
|
151
171
|
- lib/core/field.rb
|
172
|
+
- lib/core/fields_missing_strategy.rb
|
173
|
+
- lib/core/table_errors.rb
|
152
174
|
- lib/data-anonymization.rb
|
153
175
|
- lib/parallel/table.rb
|
154
176
|
- lib/strategy/base.rb
|
155
177
|
- lib/strategy/blacklist.rb
|
178
|
+
- lib/strategy/field/anonymize_array.rb
|
156
179
|
- lib/strategy/field/anonymous.rb
|
157
180
|
- lib/strategy/field/contact/geojson_base.rb
|
158
181
|
- lib/strategy/field/contact/random_address.rb
|
@@ -183,6 +206,7 @@ files:
|
|
183
206
|
- lib/strategy/field/random_boolean.rb
|
184
207
|
- lib/strategy/field/string/formatted_string_numbers.rb
|
185
208
|
- lib/strategy/field/string/lorem_ipsum.rb
|
209
|
+
- lib/strategy/field/string/random_formatted_string.rb
|
186
210
|
- lib/strategy/field/string/random_string.rb
|
187
211
|
- lib/strategy/field/string/random_url.rb
|
188
212
|
- lib/strategy/field/string/select_from_database.rb
|
@@ -190,25 +214,37 @@ files:
|
|
190
214
|
- lib/strategy/field/string/select_from_list.rb
|
191
215
|
- lib/strategy/field/string/string_template.rb
|
192
216
|
- lib/strategy/field/whitelist.rb
|
217
|
+
- lib/strategy/mongodb/anonymize_field.rb
|
218
|
+
- lib/strategy/mongodb/blacklist.rb
|
219
|
+
- lib/strategy/mongodb/whitelist.rb
|
193
220
|
- lib/strategy/strategies.rb
|
194
221
|
- lib/strategy/whitelist.rb
|
195
222
|
- lib/tasks/rake_tasks.rb
|
223
|
+
- lib/thor/helpers/mongodb_dsl_generator.rb
|
224
|
+
- lib/thor/helpers/rdbms_dsl_generator.rb
|
225
|
+
- lib/thor/templates/mongodb_whitelist_template.erb
|
226
|
+
- lib/thor/templates/whitelist_template.erb
|
196
227
|
- lib/utils/database.rb
|
197
228
|
- lib/utils/geojson_parser.rb
|
198
229
|
- lib/utils/logging.rb
|
230
|
+
- lib/utils/parallel_progress_bar.rb
|
199
231
|
- lib/utils/progress_bar.rb
|
200
232
|
- lib/utils/random_float.rb
|
201
233
|
- lib/utils/random_int.rb
|
202
234
|
- lib/utils/random_string.rb
|
203
235
|
- lib/utils/random_string_chars_only.rb
|
204
236
|
- lib/utils/resource.rb
|
237
|
+
- lib/utils/template_helper.rb
|
205
238
|
- lib/version.rb
|
206
239
|
- resources/UK_addresses.geojson
|
207
240
|
- resources/US_addresses.geojson
|
208
241
|
- resources/first_names.txt
|
209
242
|
- resources/last_names.txt
|
243
|
+
- spec/acceptance/mongodb_blacklist_spec.rb
|
244
|
+
- spec/acceptance/mongodb_whitelist_spec.rb
|
210
245
|
- spec/acceptance/rdbms_blacklist_spec.rb
|
211
246
|
- spec/acceptance/rdbms_whitelist_spec.rb
|
247
|
+
- spec/core/fields_missing_strategy_spec.rb
|
212
248
|
- spec/resource/sample.geojson
|
213
249
|
- spec/spec_helper.rb
|
214
250
|
- spec/strategy/field/contact/random_address_spec.rb
|
@@ -238,18 +274,23 @@ files:
|
|
238
274
|
- spec/strategy/field/random_boolean_spec.rb
|
239
275
|
- spec/strategy/field/string/formatted_string_numbers_spec.rb
|
240
276
|
- spec/strategy/field/string/lorem_ipsum_spec.rb
|
277
|
+
- spec/strategy/field/string/random_formatted_string_spec.rb
|
241
278
|
- spec/strategy/field/string/random_string_spec.rb
|
242
279
|
- spec/strategy/field/string/random_url_spec.rb
|
243
280
|
- spec/strategy/field/string/select_from_database_spec.rb
|
281
|
+
- spec/strategy/field/string/select_from_file_spec.rb
|
244
282
|
- spec/strategy/field/string/select_from_list_spec.rb
|
245
283
|
- spec/strategy/field/string/string_template_spec.rb
|
246
284
|
- spec/strategy/field/whitelist_spec.rb
|
285
|
+
- spec/strategy/mongodb/anonymize_field_spec.rb
|
247
286
|
- spec/support/customer_sample.rb
|
248
287
|
- spec/utils/database_spec.rb
|
249
288
|
- spec/utils/geojson_parser_spec.rb
|
289
|
+
- spec/utils/random_float_spec.rb
|
250
290
|
- spec/utils/random_int_spec.rb
|
291
|
+
- spec/utils/random_string_char_only_spec.rb
|
251
292
|
- spec/utils/random_string_spec.rb
|
252
|
-
-
|
293
|
+
- spec/utils/template_helper_spec.rb
|
253
294
|
homepage: http://sunitparekh.github.com/data-anonymization
|
254
295
|
licenses: []
|
255
296
|
post_install_message:
|
@@ -276,8 +317,11 @@ specification_version: 3
|
|
276
317
|
summary: Tool to create anonymized production data dump to use for PREF and other
|
277
318
|
TEST environments.
|
278
319
|
test_files:
|
320
|
+
- spec/acceptance/mongodb_blacklist_spec.rb
|
321
|
+
- spec/acceptance/mongodb_whitelist_spec.rb
|
279
322
|
- spec/acceptance/rdbms_blacklist_spec.rb
|
280
323
|
- spec/acceptance/rdbms_whitelist_spec.rb
|
324
|
+
- spec/core/fields_missing_strategy_spec.rb
|
281
325
|
- spec/resource/sample.geojson
|
282
326
|
- spec/spec_helper.rb
|
283
327
|
- spec/strategy/field/contact/random_address_spec.rb
|
@@ -307,14 +351,20 @@ test_files:
|
|
307
351
|
- spec/strategy/field/random_boolean_spec.rb
|
308
352
|
- spec/strategy/field/string/formatted_string_numbers_spec.rb
|
309
353
|
- spec/strategy/field/string/lorem_ipsum_spec.rb
|
354
|
+
- spec/strategy/field/string/random_formatted_string_spec.rb
|
310
355
|
- spec/strategy/field/string/random_string_spec.rb
|
311
356
|
- spec/strategy/field/string/random_url_spec.rb
|
312
357
|
- spec/strategy/field/string/select_from_database_spec.rb
|
358
|
+
- spec/strategy/field/string/select_from_file_spec.rb
|
313
359
|
- spec/strategy/field/string/select_from_list_spec.rb
|
314
360
|
- spec/strategy/field/string/string_template_spec.rb
|
315
361
|
- spec/strategy/field/whitelist_spec.rb
|
362
|
+
- spec/strategy/mongodb/anonymize_field_spec.rb
|
316
363
|
- spec/support/customer_sample.rb
|
317
364
|
- spec/utils/database_spec.rb
|
318
365
|
- spec/utils/geojson_parser_spec.rb
|
366
|
+
- spec/utils/random_float_spec.rb
|
319
367
|
- spec/utils/random_int_spec.rb
|
368
|
+
- spec/utils/random_string_char_only_spec.rb
|
320
369
|
- spec/utils/random_string_spec.rb
|
370
|
+
- spec/utils/template_helper_spec.rb
|
data/blacklist_dsl.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
system "bundle exec ruby whitelist_dsl.rb"
|
2
|
-
|
3
|
-
require 'data-anonymization'
|
4
|
-
|
5
|
-
DataAnon::Utils::Logging.logger.level = Logger::INFO
|
6
|
-
|
7
|
-
database 'Chinook' do
|
8
|
-
strategy DataAnon::Strategy::Blacklist
|
9
|
-
source_db :adapter => 'sqlite3', :database => 'sample-data/chinook-empty.sqlite'
|
10
|
-
|
11
|
-
table 'MediaType' do
|
12
|
-
primary_key 'MediaTypeId'
|
13
|
-
anonymize('Name').using FieldStrategy::StringTemplate.new('Media Type 100#{row_number}')
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
|
data/blacklist_nosql_dsl.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'data-anonymization'
|
2
|
-
|
3
|
-
FS = DataAnon::Strategy::Field
|
4
|
-
|
5
|
-
DataAnon::Utils::Logging.logger.level = Logger::INFO
|
6
|
-
|
7
|
-
# DSL for NOSQL database, NOT IMPLEMENTED YET
|
8
|
-
|
9
|
-
database 'Chinook' do
|
10
|
-
strategy DataAnon::Strategy::NoSQL::Blacklist
|
11
|
-
source_db :adapter => 'sqlite3', :database => 'sample-data/chinook-empty.sqlite'
|
12
|
-
|
13
|
-
document 'User' do
|
14
|
-
primary_key 'MediaTypeId'
|
15
|
-
whitelist
|
16
|
-
|
17
|
-
node 'address' do
|
18
|
-
whitelist 'addrssline1', 'addressline2'
|
19
|
-
anonymize
|
20
|
-
anonymize 'pincode'
|
21
|
-
|
22
|
-
node 'contacts' do
|
23
|
-
anonymize('phone-number').using FS::RandomPhoneNumber.new
|
24
|
-
end
|
25
|
-
|
26
|
-
anonymize 'contacts/phone-number'
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
anonymize 'address/contacts/phone-number'
|
31
|
-
|
32
|
-
anonymize('Name').using FS::StringTemplate.new('Media Type 100#{row_number}')
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|