standard_audit 0.15.0 → 0.15.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 +4 -4
- data/CHANGELOG.md +11 -0
- data/app/models/standard_audit/audit_log.rb +26 -2
- data/lib/standard_audit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3d166172ff4fb5afad44ee41bdc696458000759d778d26978feba930a1f0f15d
|
|
4
|
+
data.tar.gz: 04f546a81c899d026a38d5db3ae9ec18d0e8be7968bd6dc00fbb8bd521b01704
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0ff1c20d8dcb9b23d6b6aac9e5c25c9c64ab2a31a3117f5a646ae6018d99bca5bdc09fe8c11010ccfeab83231d63bbd7354872c9dafac249719d54e18da97dbd
|
|
7
|
+
data.tar.gz: d546320a519c833a3015a01887fea2459d9fe83c936e417eaae240059c94ed1fab08666d71da0773229a475424edd04834c19396287a6454ba317d1f868301fc
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.15.1] - 2026-10-28
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **`anonymize_actor!` also strips anonymizable keys from nested metadata.**
|
|
15
|
+
It used to drop `anonymizable_metadata_keys` (`email`, `name`, `ip_address`)
|
|
16
|
+
from the top level only, so a publisher that nests the subject's details
|
|
17
|
+
(standard_id's `social.auth.completed` carries `social_info: { email: ... }`)
|
|
18
|
+
kept them after erasure. With `filter_nested_metadata` on (the default since
|
|
19
|
+
0.14.0) it now walks nested hashes and arrays, as the write-side filter does.
|
|
20
|
+
|
|
10
21
|
## [0.15.0] - 2026-10-28
|
|
11
22
|
|
|
12
23
|
### Security
|
|
@@ -124,8 +124,7 @@ module StandardAudit
|
|
|
124
124
|
attrs[:target_type] = "[anonymized]" if log.target_gid == gid
|
|
125
125
|
|
|
126
126
|
if log.metadata.present? && anonymizable_keys.any?
|
|
127
|
-
|
|
128
|
-
attrs[:metadata] = cleaned_metadata
|
|
127
|
+
attrs[:metadata] = strip_anonymizable_keys(log.metadata, anonymizable_keys)
|
|
129
128
|
end
|
|
130
129
|
|
|
131
130
|
attrs[:anonymized_at] = log.anonymized_at || stamp if stamp
|
|
@@ -136,6 +135,31 @@ module StandardAudit
|
|
|
136
135
|
count
|
|
137
136
|
end
|
|
138
137
|
|
|
138
|
+
# Drops the anonymizable keys from +metadata+. Nested hashes (and hashes
|
|
139
|
+
# inside arrays) are walked too when `filter_nested_metadata` is on, as the
|
|
140
|
+
# write-side MetadataFilter does: a publisher that nests the subject's
|
|
141
|
+
# email (standard_id's social `social_info: { email: ... }`) would
|
|
142
|
+
# otherwise keep it after erasure.
|
|
143
|
+
def self.strip_anonymizable_keys(metadata, keys)
|
|
144
|
+
cleaned = metadata.reject { |k, _| keys.include?(k.to_s) }
|
|
145
|
+
return cleaned unless StandardAudit.config.filter_nested_metadata
|
|
146
|
+
|
|
147
|
+
cleaned.to_h { |k, v| [k, strip_anonymizable_descendant(v, keys)] }
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def self.strip_anonymizable_descendant(value, keys)
|
|
151
|
+
case value
|
|
152
|
+
when Hash
|
|
153
|
+
value.reject { |k, _| keys.include?(k.to_s) }
|
|
154
|
+
.to_h { |k, v| [k, strip_anonymizable_descendant(v, keys)] }
|
|
155
|
+
when Array
|
|
156
|
+
value.map { |element| strip_anonymizable_descendant(element, keys) }
|
|
157
|
+
else
|
|
158
|
+
value
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
private_class_method :strip_anonymizable_keys, :strip_anonymizable_descendant
|
|
162
|
+
|
|
139
163
|
# True when the table carries `anonymized_at` (the
|
|
140
164
|
# `standard_audit:add_anonymized_at` migration, or a 0.12+ install).
|
|
141
165
|
def self.anonymization_column?
|