legionio 1.5.7 → 1.5.8

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: f1b428e7647279cf546f324872dfcc8a4cfaa18cd86239295d6d970ed3a535f3
4
- data.tar.gz: 300e15076db8273550bcc7e8431b0cbff2b644489f1a784213b81732f10dcc11
3
+ metadata.gz: dd1e62d0c34e503458b9648de476a15dd5c03a163bb506db8a4723da486aef24
4
+ data.tar.gz: 43147d5ba26541cf62f3d5255ce973480fccb1362a5d8daf224ff16b82b6e55f
5
5
  SHA512:
6
- metadata.gz: ed8f794e30b35f60492ff8ffea4c6a0a7103ebd90781a132029c60985cf50e8f5118a4f80fa792947ce346f8df3ede23368cf66d9592b1a6e0cf23259651ef77
7
- data.tar.gz: 0cb1b113f52cb6748825d75c15b23c149a1c3f0991e2bf5d77577b256516a002592dc9a18ba2bbb2ba52f8b05dba2df3d0978fcc4265b60cad49d74e9c9548df
6
+ metadata.gz: af364276c4d9589d8ee414a2e563640be7c49c472a0ef566a035b502198d7396acd055f42f576756a9bbd0beda57f09e0bb098bcb15b387da8dbf31baa728120
7
+ data.tar.gz: 44671d558a7e20e9dbda648e0ad71efd0c9db546d37507c0e21d3367a9e4c896b79476f8158597e36eb310c46415d1084dea9cfbe389405b7940a74c10609c63
data/CHANGELOG.md CHANGED
@@ -1,7 +1,23 @@
1
1
  # Legion Changelog
2
2
 
3
+ ## [1.5.8] - 2026-03-24
4
+
5
+ ### Added
6
+ - `Legion::Compliance::PhiTag` — PHI data classification tagging with `phi?`, `tag`, `tagged_cache_key` methods; gated by `compliance.phi_enabled` setting
7
+ - `Legion::Compliance::PhiAccessLog` — PHI access audit bridge that calls `Legion::Audit.record` with `event_type: 'phi_access'`; gated by `compliance.phi_enabled` setting
8
+ - `Legion::Compliance::PhiErasure` — orchestrates cryptographic erasure via `Legion::Crypt::Erasure`, cache key purge, access log, and verification; all steps guarded by `defined?` checks
9
+
3
10
  ## [1.5.7] - 2026-03-24
4
11
 
12
+ ### Added
13
+ - `Legion::Audit::Archiver` — tiered hot/warm/cold audit retention orchestrator; delegates hot→warm to `Legion::Data::Retention`, exports warm→cold as compressed JSONL via `ColdStorage`, records manifests, verifies hash chain after each run
14
+ - `Legion::Audit::ColdStorage` — upload/download abstraction with `:local` (filesystem) and `:s3` (aws-sdk-s3, optional) backends; raises `BackendNotAvailableError` when aws-sdk-s3 not installed
15
+ - `Legion::Audit::ArchiverActor` — thread-based weekly scheduled actor with hour/day-of-week cron guard; started by `Service#setup_audit_archiver` after telemetry
16
+ - `legion audit archive --dry-run / --execute` — preview or execute tiered archival from CLI
17
+ - `legion audit verify_chain --tier --start --end` — direct hash chain integrity check for hot or warm tier
18
+ - `legion audit restore --date` — restore cold JSONL archives back to warm tier for querying
19
+ - Feature flag: `audit.retention.enabled` (default `false`); settings: `hot_days`, `warm_days`, `cold_years`, `cold_storage`, `cold_backend`, `archive_schedule`, `verify_on_archive`
20
+
5
21
  ### Changed
6
22
  - `Legion::Service` starts `CertRotation` after `Crypt.start` when `security.mtls.enabled: true`
7
23
  - `Legion::Service#shutdown` stops `CertRotation` before `Crypt.shutdown`
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Compliance
5
+ module PhiErasure
6
+ class << self
7
+ def erase(task_id:, reason:)
8
+ result = { task_id: task_id, erased: false, steps: {} }
9
+
10
+ result[:steps][:key_erasure] = erase_key(task_id)
11
+ result[:steps][:cache_purge] = purge_cache(task_id)
12
+ log_erasure(task_id: task_id, reason: reason)
13
+ result[:steps][:verification] = verify_erasure(task_id)
14
+
15
+ key_result = result[:steps][:key_erasure]
16
+ verify_result = result[:steps][:verification]
17
+
18
+ result[:erased] = key_result.nil? || (key_result.is_a?(Hash) && key_result[:erased] != false &&
19
+ verify_result.is_a?(Hash) && verify_result[:erased] != false)
20
+ result
21
+ rescue StandardError => e
22
+ Legion::Logging.error "[Compliance] PhiErasure#erase failed task_id=#{task_id}: #{e.message}" if defined?(Legion::Logging)
23
+ { task_id: task_id, erased: false, error: e.message }
24
+ end
25
+
26
+ private
27
+
28
+ def erase_key(task_id)
29
+ return nil unless defined?(Legion::Crypt::Erasure)
30
+
31
+ Legion::Crypt::Erasure.erase_tenant(tenant_id: task_id)
32
+ end
33
+
34
+ def purge_cache(task_id)
35
+ return nil unless defined?(Legion::Cache)
36
+
37
+ prefix = "phi:#{task_id}:"
38
+ Legion::Cache.delete(prefix)
39
+ { purged: true, prefix: prefix }
40
+ rescue StandardError => e
41
+ { purged: false, error: e.message }
42
+ end
43
+
44
+ def log_erasure(task_id:, reason:)
45
+ return unless defined?(Legion::Compliance::PhiAccessLog)
46
+
47
+ Legion::Compliance::PhiAccessLog.log_access(
48
+ resource: task_id,
49
+ action: 'erasure',
50
+ actor: 'system:phi_erasure',
51
+ reason: reason
52
+ )
53
+ end
54
+
55
+ def verify_erasure(task_id)
56
+ return nil unless defined?(Legion::Crypt::Erasure)
57
+
58
+ Legion::Crypt::Erasure.verify_erasure(tenant_id: task_id)
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'legion/compliance/phi_tag'
4
4
  require 'legion/compliance/phi_access_log'
5
+ require 'legion/compliance/phi_erasure'
5
6
 
6
7
  module Legion
7
8
  module Compliance
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Legion
4
- VERSION = '1.5.7'
4
+ VERSION = '1.5.8'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legionio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.7
4
+ version: 1.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
@@ -673,6 +673,7 @@ files:
673
673
  - lib/legion/cluster/lock.rb
674
674
  - lib/legion/compliance.rb
675
675
  - lib/legion/compliance/phi_access_log.rb
676
+ - lib/legion/compliance/phi_erasure.rb
676
677
  - lib/legion/compliance/phi_tag.rb
677
678
  - lib/legion/context.rb
678
679
  - lib/legion/data/local_migrations/20260319000001_create_extension_catalog.rb