data-anonymization 0.8.3 → 0.8.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +2 -3
- data/README.md +3 -0
- data/data-anonymization.gemspec +8 -8
- data/lib/strategy/field/datetime/anonymize_time.rb +3 -3
- data/lib/strategy/field/number/random_big_decimal_delta.rb +1 -1
- data/lib/utils/database.rb +1 -1
- data/lib/utils/random_int.rb +2 -2
- data/lib/version.rb +1 -1
- data/spec/strategy/field/number/random_big_decimal_delta_spec.rb +1 -1
- data/spec/support/customer_sample.rb +2 -2
- data/spec/utils/database_spec.rb +4 -4
- metadata +26 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8dd6cd4c88130c0107c37fdadf96b9c988433c43c52b7fa7b6b5a753717b045b
|
4
|
+
data.tar.gz: 51f8b7fd6e666c0f5c2438430d01a657868a5c97a062b46dce1e3f21a3cd88e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04254c1498d44ef75efd355181cf1dd8cfaf782ea4d42b3a97d27f0e2a6d513c96981546a667dcd875df9417f1bd6cff2f32cbedaf973688c216d4ca7ac2f464
|
7
|
+
data.tar.gz: c954f6aeb3f0774c49d14d354d1144a8edd8516685ff71da908ababf5488e0f8874a5abf56a351a10609095525099050bac469e688bd3c84ec0dae858bc81ad7
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-
|
1
|
+
ruby-3.1.0
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -81,6 +81,9 @@ Postgresql database having **composite primary key**
|
|
81
81
|
|
82
82
|
## Changelog
|
83
83
|
|
84
|
+
#### 0.8.5 (May 28, 2020)
|
85
|
+
1. Upgraded to rails 6.x
|
86
|
+
|
84
87
|
#### 0.8.1 (Aug 19, 2017)
|
85
88
|
1. Multi-threading support added by [stanislav-tyutin](https://github.com/stanislav-tyutin) using Pull Request.
|
86
89
|
2. Fixed to work with Ruby 2.4.x, issue with Integer data type
|
data/data-anonymization.gemspec
CHANGED
@@ -19,12 +19,12 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
20
20
|
gem.require_paths = ['lib']
|
21
21
|
|
22
|
-
gem.add_dependency('activerecord', '~>
|
23
|
-
gem.add_dependency('
|
24
|
-
gem.add_dependency('
|
25
|
-
gem.add_dependency('
|
26
|
-
gem.add_dependency('
|
27
|
-
gem.add_dependency('
|
28
|
-
gem.add_dependency('
|
29
|
-
gem.add_dependency('thor', '~>
|
22
|
+
gem.add_dependency('activerecord', '~> 7.0')
|
23
|
+
gem.add_dependency('activesupport', '~> 7.0')
|
24
|
+
gem.add_dependency('composite_primary_keys', '~> 14.0')
|
25
|
+
gem.add_dependency('parallel', '~> 1.21')
|
26
|
+
gem.add_dependency('powerbar', '~> 2.0')
|
27
|
+
gem.add_dependency('rgeo', '~> 2.3')
|
28
|
+
gem.add_dependency('rgeo-geojson', '~> 2.1')
|
29
|
+
gem.add_dependency('thor', '~> 1.1')
|
30
30
|
end
|
@@ -58,8 +58,8 @@ module DataAnon
|
|
58
58
|
month = @anonymize_month? DataAnon::Utils::RandomInt.generate(1,12) : original_time.month
|
59
59
|
days_in_month = Time.new(year,month,1,1,1,1).end_of_month.day
|
60
60
|
day = @anonymize_day? DataAnon::Utils::RandomInt.generate(1,days_in_month) : original_time.day
|
61
|
-
hour = @anonymize_hour? DataAnon::Utils::RandomInt.generate(
|
62
|
-
min = @anonymize_min? DataAnon::Utils::RandomInt.generate(
|
61
|
+
hour = @anonymize_hour? DataAnon::Utils::RandomInt.generate(0,23) : original_time.hour
|
62
|
+
min = @anonymize_min? DataAnon::Utils::RandomInt.generate(0,59) : original_time.min
|
63
63
|
sec = original_time.sec
|
64
64
|
|
65
65
|
create_object(year, month, day, hour, min, sec)
|
@@ -74,4 +74,4 @@ module DataAnon
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
77
|
-
end
|
77
|
+
end
|
@@ -16,7 +16,7 @@ module DataAnon
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def anonymize field
|
19
|
-
return BigDecimal
|
19
|
+
return BigDecimal("#{field.value + DataAnon::Utils::RandomFloat.generate(-@delta, +@delta)}")
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
data/lib/utils/database.rb
CHANGED
@@ -25,7 +25,7 @@ module DataAnon
|
|
25
25
|
|
26
26
|
def self.create_table database, table_name, primary_keys = []
|
27
27
|
klass_name = table_name.to_s.downcase.capitalize
|
28
|
-
return database.const_get
|
28
|
+
return database.const_get(klass_name, false) if database.const_defined?(klass_name, false)
|
29
29
|
database.const_set(klass_name, Class.new(database) do
|
30
30
|
self.table_name = table_name
|
31
31
|
self.primary_keys = primary_keys if primary_keys.length > 1
|
data/lib/utils/random_int.rb
CHANGED
data/lib/version.rb
CHANGED
@@ -4,7 +4,7 @@ require 'bigdecimal'
|
|
4
4
|
describe FieldStrategy::RandomBigDecimalDelta do
|
5
5
|
|
6
6
|
RandomBigDecimalDelta = FieldStrategy::RandomBigDecimalDelta
|
7
|
-
let(:field) {DataAnon::Core::Field.new('decimal_field',BigDecimal
|
7
|
+
let(:field) {DataAnon::Core::Field.new('decimal_field',BigDecimal("53422342378687687342893.23324"),1,nil)}
|
8
8
|
|
9
9
|
describe 'anonymized big decimal should not be the same as original value' do
|
10
10
|
let(:anonymized_value) {RandomBigDecimalDelta.new.anonymize(field)}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class CustomerSample
|
2
2
|
|
3
|
-
class CreateCustomer < ActiveRecord::Migration[
|
3
|
+
class CreateCustomer < ActiveRecord::Migration[7.0]
|
4
4
|
def up
|
5
|
-
create_table :customers,
|
5
|
+
create_table :customers, :id => false, :force => true do |t|
|
6
6
|
t.integer :cust_id, :primary => true
|
7
7
|
t.string :first_name
|
8
8
|
t.string :last_name
|
data/spec/utils/database_spec.rb
CHANGED
@@ -16,10 +16,10 @@ describe 'Utils' do
|
|
16
16
|
album.all.length > 0
|
17
17
|
end
|
18
18
|
|
19
|
-
it '
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
it 'ignores inherited constants when creating a table with matching name' do
|
20
|
+
conditionals = DataAnon::Utils::SourceTable.create 'Conditionals'
|
21
|
+
conditionals.count.should == 0
|
22
|
+
conditionals.all.length == 0
|
23
23
|
end
|
24
24
|
|
25
25
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data-anonymization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sunit Parekh
|
8
8
|
- Anand Agrawal
|
9
9
|
- Satyam Agarwala
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2022-01-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
@@ -18,58 +18,58 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
21
|
+
version: '7.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: '
|
28
|
+
version: '7.0'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
|
-
name:
|
30
|
+
name: activesupport
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: '
|
35
|
+
version: '7.0'
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
42
|
+
version: '7.0'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
|
-
name:
|
44
|
+
name: composite_primary_keys
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
49
|
+
version: '14.0'
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: '
|
56
|
+
version: '14.0'
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
|
-
name:
|
58
|
+
name: parallel
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: '1.
|
63
|
+
version: '1.21'
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - "~>"
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: '1.
|
70
|
+
version: '1.21'
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
|
-
name:
|
72
|
+
name: powerbar
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
75
|
- - "~>"
|
@@ -83,47 +83,47 @@ dependencies:
|
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '2.0'
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
|
-
name:
|
86
|
+
name: rgeo
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
89
|
- - "~>"
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
version: '
|
91
|
+
version: '2.3'
|
92
92
|
type: :runtime
|
93
93
|
prerelease: false
|
94
94
|
version_requirements: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
96
|
- - "~>"
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version: '
|
98
|
+
version: '2.3'
|
99
99
|
- !ruby/object:Gem::Dependency
|
100
|
-
name:
|
100
|
+
name: rgeo-geojson
|
101
101
|
requirement: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
103
|
- - "~>"
|
104
104
|
- !ruby/object:Gem::Version
|
105
|
-
version: '1
|
105
|
+
version: '2.1'
|
106
106
|
type: :runtime
|
107
107
|
prerelease: false
|
108
108
|
version_requirements: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
110
|
- - "~>"
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version: '1
|
112
|
+
version: '2.1'
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: thor
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
117
|
- - "~>"
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version:
|
119
|
+
version: '1.1'
|
120
120
|
type: :runtime
|
121
121
|
prerelease: false
|
122
122
|
version_requirements: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
124
|
- - "~>"
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version:
|
126
|
+
version: '1.1'
|
127
127
|
description: Data anonymization tool for RDBMS and MongoDB databases
|
128
128
|
email:
|
129
129
|
- parekh.sunit@gmail.com
|
@@ -283,7 +283,7 @@ homepage: http://sunitparekh.github.com/data-anonymization
|
|
283
283
|
licenses:
|
284
284
|
- MIT
|
285
285
|
metadata: {}
|
286
|
-
post_install_message:
|
286
|
+
post_install_message:
|
287
287
|
rdoc_options: []
|
288
288
|
require_paths:
|
289
289
|
- lib
|
@@ -298,9 +298,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
298
298
|
- !ruby/object:Gem::Version
|
299
299
|
version: '0'
|
300
300
|
requirements: []
|
301
|
-
|
302
|
-
|
303
|
-
signing_key:
|
301
|
+
rubygems_version: 3.3.3
|
302
|
+
signing_key:
|
304
303
|
specification_version: 4
|
305
304
|
summary: Tool to create anonymized production data dump to use for performance and
|
306
305
|
testing environments.
|