tidus 1.2.4 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97e5c63dd6fb5b0b3aba2bb7ff592263993f3fa0c241fc38e6b017bbcb85b003
|
4
|
+
data.tar.gz: 473e8cfcc317cc578f9e1419bee4dfbb8b5fc063dca6f64868eb974a598e90e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26463c2f04d7ffb41f59fa87f8a7dadc3b21400b6c54e311fd9efb795ac79dc9e9ea1b39fc4ba5a6ffbd069262821c2ca40d1ea45503719eb172e0ed55fe8794
|
7
|
+
data.tar.gz: 8690be5c03957451a8bd16777cb6166c952debbdf8d36398f5173bd1912bbf5850ef1e1a81a9fa4f96d66a327e58164ec267133cc1f60fd213cfb86b225950e9
|
@@ -1,15 +1,27 @@
|
|
1
1
|
module Tidus
|
2
2
|
module Postgresql
|
3
3
|
class EmailAnonymizer
|
4
|
+
|
4
5
|
def self.anonymize(table_name, column_name, options = {})
|
5
6
|
name = "#{table_name}.#{column_name}"
|
6
|
-
options[:length]
|
7
|
+
length = options[:length] || 15
|
8
|
+
anonymize_domain = options[:anonymize_domain] || false
|
7
9
|
|
8
10
|
return "CASE WHEN ((#{name})::text ~~ '%@%'::text) " +
|
9
|
-
"THEN (((\"left\"(md5((#{name})::text), #{
|
10
|
-
"||
|
11
|
+
"THEN (((\"left\"(md5((#{name})::text), #{length}) || '@'::text) " +
|
12
|
+
"|| #{domain_part(name, anonymize_domain, length)}))::character varying " +
|
11
13
|
"ELSE #{name} END"
|
12
14
|
end
|
15
|
+
|
16
|
+
def self.domain_part(name, anonymize_domain, length)
|
17
|
+
if anonymize_domain
|
18
|
+
return "(\"left\"(md5(split_part((#{name})::text, '@'::text, 2)::text), #{length}) " +
|
19
|
+
"|| '.com')"
|
20
|
+
end
|
21
|
+
|
22
|
+
return "split_part((#{name})::text, '@'::text, 2)"
|
23
|
+
end
|
24
|
+
|
13
25
|
end
|
14
26
|
end
|
15
27
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Tidus
|
2
|
+
module Postgresql
|
3
|
+
class Sha256Anonymizer
|
4
|
+
|
5
|
+
def self.anonymize(table_name, column_name, options = {})
|
6
|
+
name = "#{table_name}.#{column_name}"
|
7
|
+
|
8
|
+
length = options[:length] || 64
|
9
|
+
|
10
|
+
return "SUBSTR(ENCODE(DIGEST(#{name}, 'sha256')::BYTEA, 'HEX'), 0, #{length.to_i + 1})"
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/tidus/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tidus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Schoknecht
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -90,9 +90,11 @@ files:
|
|
90
90
|
- lib/tidus/strategies/postgresql/overlay_anonymizer.rb
|
91
91
|
- lib/tidus/strategies/postgresql/regex_replace_anonymizer.rb
|
92
92
|
- lib/tidus/strategies/postgresql/remove_json_keys_anonymizer.rb
|
93
|
+
- lib/tidus/strategies/postgresql/sha256_anonymizer.rb
|
93
94
|
- lib/tidus/strategies/postgresql/text_anonymizer.rb
|
94
95
|
- lib/tidus/strategies/regex_replace_anonymizer.rb
|
95
96
|
- lib/tidus/strategies/remove_json_keys_anonymizer.rb
|
97
|
+
- lib/tidus/strategies/sha256_anonymizer.rb
|
96
98
|
- lib/tidus/strategies/sqlite3/null_anonymizer.rb
|
97
99
|
- lib/tidus/strategies/static_anonymizer.rb
|
98
100
|
- lib/tidus/strategies/text_anonymizer.rb
|
@@ -101,7 +103,7 @@ homepage: ''
|
|
101
103
|
licenses:
|
102
104
|
- MIT
|
103
105
|
metadata: {}
|
104
|
-
post_install_message:
|
106
|
+
post_install_message:
|
105
107
|
rdoc_options: []
|
106
108
|
require_paths:
|
107
109
|
- lib
|
@@ -116,8 +118,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
118
|
- !ruby/object:Gem::Version
|
117
119
|
version: '0'
|
118
120
|
requirements: []
|
119
|
-
rubygems_version: 3.
|
120
|
-
signing_key:
|
121
|
+
rubygems_version: 3.4.10
|
122
|
+
signing_key:
|
121
123
|
specification_version: 4
|
122
124
|
summary: Gem for creating anonymization views.
|
123
125
|
test_files: []
|