dbviewer 0.8.0 → 0.8.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 988493e4778410960da76a39e233df19e74a8155393a2b7cbe39a5f073c5d905
4
- data.tar.gz: 5fbc3a34833d8d7758b786623bf3a5767699f80bba68ba953415e791d63fe86f
3
+ metadata.gz: 12d0c138efd718011eda36a79ea33a9e96f6609032b1160249e19876df86d00e
4
+ data.tar.gz: 11150deaa07278a6073f9977000fc4075ac0d24f671601a3525d19afd27b2e25
5
5
  SHA512:
6
- metadata.gz: 06c52e89a4342edcc7edfb15f91ef5c53bc528ddff3b56bb3f7a0a9d9967b2c75ecf41e8850bdab13a535e93dbdb9036bf545aac4e4b55aeb0a05b9fec0b1b2e
7
- data.tar.gz: a18bd6e86c8dcd70dc851e2800d13cf150fe5a08ec1c4c606bd6d714e4dd62a3548b1bfc7e9510c8f8836fb01a783a5a6be32b5d6344bd0cd040c3da430e92b6
6
+ metadata.gz: 0e0bfde143b99b1412a405d46eee0e13efb3711d7b33a297c0327f712dfb946acb808052b377df970dfae65e97656a826af3cab7896a0e544831ad9942a048a4
7
+ data.tar.gz: 342ee2c29f04c64d68272f843c45860bf60a51e61e338d1a9ff5ae579d85ec6a5684d4bbd12f95b46a1f452100eb01796d57a0caa2a96b0b5732aecb050a4896
@@ -1,3 +1,3 @@
1
1
  module Dbviewer
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
3
3
  end
@@ -8,10 +8,8 @@ module Dbviewer
8
8
  copy_file "initializer.rb", "config/initializers/dbviewer.rb"
9
9
  end
10
10
 
11
- def copy_pii_example
12
- copy_file "pii_configuration_example.rb", "config/initializers/dbviewer_pii_example.rb"
13
- say "Created example PII configuration at config/initializers/dbviewer_pii_example.rb", :green
14
- say "Review and customize the PII masking rules, then rename to dbviewer_pii.rb to activate.", :yellow
11
+ def copy_pii
12
+ copy_file "dbviewer_pii.rb", "config/initializers/dbviewer_pii.rb"
15
13
  end
16
14
  end
17
15
  end
@@ -0,0 +1,26 @@
1
+ Dbviewer.configure do |config|
2
+ # Enable/disable PII masking globally (default: true)
3
+ # config.enable_pii_masking = true
4
+ end
5
+
6
+ # Configure PII masking rules
7
+ Dbviewer.configure_pii do |pii|
8
+ # pii.mask "users.email", with: :email
9
+ # pii.mask "customers.email_address", with: :email
10
+
11
+ # # Custom masking with lambda/proc:
12
+ # pii.mask "users.address", with: ->(value) {
13
+ # return value if value.nil?
14
+ # "#{value.split(' ').first} ***" # Show only first word
15
+ # }
16
+
17
+ # # Define custom masking functions that can be reused:
18
+ # pii.custom_mask :ip_mask, ->(value) {
19
+ # return value if value.nil?
20
+ # parts = value.split(".")
21
+ # return value if parts.length != 4
22
+ # "#{parts[0]}.#{parts[1]}.***.***.***"
23
+ # }
24
+ # pii.mask "logs.ip_address", with: :ip_mask
25
+ # pii.mask "sessions.client_ip", with: :ip_mask
26
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbviewer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wailan Tirajoh
@@ -166,8 +166,8 @@ files:
166
166
  - lib/dbviewer/validator/sql/validation_result.rb
167
167
  - lib/dbviewer/version.rb
168
168
  - lib/generators/dbviewer/install_generator.rb
169
+ - lib/generators/dbviewer/templates/dbviewer_pii.rb
169
170
  - lib/generators/dbviewer/templates/initializer.rb
170
- - lib/generators/dbviewer/templates/pii_configuration_example.rb
171
171
  - lib/tasks/dbviewer_tasks.rake
172
172
  homepage: https://github.com/wailantirajoh/dbviewer
173
173
  licenses:
@@ -1,99 +0,0 @@
1
- # Example DBViewer PII Configuration
2
- #
3
- # This file shows how to configure PII (Personally Identifiable Information) masking
4
- # in DBViewer to protect sensitive data in your database views.
5
- #
6
- # Place this configuration in your Rails initializer file (e.g., config/initializers/dbviewer.rb)
7
-
8
- Dbviewer.configure do |config|
9
- # Enable/disable PII masking globally (default: true)
10
- config.enable_pii_masking = true
11
-
12
- # Other DBViewer configurations...
13
- # config.default_per_page = 20
14
- # config.enable_data_export = false
15
- end
16
-
17
- # Configure PII masking rules
18
- Dbviewer.configure_pii do |pii|
19
- # Built-in masking types:
20
-
21
- # Email masking: john.doe@example.com -> jo***@example.com
22
- pii.mask "users.email", with: :email
23
- pii.mask "customers.email_address", with: :email
24
-
25
- # Phone masking: +1234567890 -> +1***90
26
- pii.mask "users.phone", with: :phone
27
- pii.mask "profiles.mobile_number", with: :phone
28
-
29
- # Social Security Number masking: 123456789 -> ***-**-6789
30
- pii.mask "users.ssn", with: :ssn
31
- pii.mask "employees.social_security", with: :ssn
32
-
33
- # Credit card masking: 1234567890123456 -> ****-****-****-3456
34
- pii.mask "payments.card_number", with: :credit_card
35
-
36
- # Full redaction: any_value -> ***REDACTED***
37
- pii.mask "users.api_key", with: :full_redact
38
- pii.mask "accounts.secret_token", with: :full_redact
39
-
40
- # Partial masking (default): john_doe -> jo***oe
41
- pii.mask "users.username", with: :partial
42
-
43
- # Custom masking with lambda/proc:
44
- pii.mask "users.address", with: ->(value) {
45
- return value if value.nil?
46
- "#{value.split(' ').first} ***" # Show only first word
47
- }
48
-
49
- # Define custom masking functions that can be reused:
50
- pii.custom_mask :ip_mask, ->(value) {
51
- return value if value.nil?
52
- parts = value.split(".")
53
- return value if parts.length != 4
54
- "#{parts[0]}.#{parts[1]}.***.***.***"
55
- }
56
-
57
- # Use custom mask:
58
- pii.mask "logs.ip_address", with: :ip_mask
59
- pii.mask "sessions.client_ip", with: :ip_mask
60
-
61
- # More examples:
62
-
63
- # Customer data
64
- pii.mask "customers.first_name", with: :partial
65
- pii.mask "customers.last_name", with: :partial
66
- pii.mask "customers.date_of_birth", with: ->(value) {
67
- return value if value.nil?
68
- date = Date.parse(value.to_s) rescue nil
69
- date ? "#{date.year}/***/**" : value
70
- }
71
-
72
- # Employee data
73
- pii.mask "employees.salary", with: ->(value) { value ? "$***,***" : value }
74
- pii.mask "employees.bank_account", with: :full_redact
75
-
76
- # User profiles
77
- pii.mask "profiles.biography", with: ->(value) {
78
- return value if value.nil? || value.length <= 50
79
- "#{value[0..50]}... [TRUNCATED FOR PRIVACY]"
80
- }
81
-
82
- # System logs with PII
83
- pii.mask "audit_logs.user_data", with: :full_redact
84
- pii.mask "error_logs.request_params", with: ->(value) {
85
- # Redact JSON containing potential PII
86
- return value if value.nil?
87
- begin
88
- JSON.parse(value)
89
- "{ [REDACTED JSON DATA] }"
90
- rescue
91
- value
92
- end
93
- }
94
- end
95
-
96
- # You can also disable PII masking globally:
97
- # Dbviewer.configure_pii do |pii|
98
- # pii.enabled = false
99
- # end