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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9372349d710bae063f9384029caef1467f308d63766ddd3216558e7442068c28
4
- data.tar.gz: 57956388488eb0c875c0a67dfdc101a72ea0588369bef06ef3e18009784f8d6a
3
+ metadata.gz: 3d166172ff4fb5afad44ee41bdc696458000759d778d26978feba930a1f0f15d
4
+ data.tar.gz: 04f546a81c899d026a38d5db3ae9ec18d0e8be7968bd6dc00fbb8bd521b01704
5
5
  SHA512:
6
- metadata.gz: 6baf203963e2df6713d6f16037ba93c00d26aa182315b3e6ad3b2c8731e1bf4c078ba15ff2a25437e9f6eb3c7e61b41ee5657d1db31c83c0c543be0cd360cec2
7
- data.tar.gz: bd922770bb429ac240b7f365ee0471eb93e155cebb454858d12cea6b884d6bc86319eefb7feaee79dd511070e2721669cdcb3d1765200c1b6e3b017dc1cc5c54
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
- cleaned_metadata = log.metadata.reject { |k, _| anonymizable_keys.include?(k.to_s) }
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?
@@ -1,3 +1,3 @@
1
1
  module StandardAudit
2
- VERSION = "0.15.0"
2
+ VERSION = "0.15.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standard_audit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaryl Sim