feat(audit-api): fix 7 gaps — module catalog, Diff ingest, filters, chain verify

- Add release/doctor/signals/advisory-ai/riskengine to module catalog (Gap 1)
- Add Diff to UnifiedAuditIngestRequest for before/after state (Gap 2)
- Add resourceName, actorIp, actorEmail query parameters (Gap 3, 8)
- Add GIN index on details_jsonb for future JSONB queries (Gap 6)
- Map chain verification endpoint GET /api/v1/audit/chain/verify (Gap 7)
- Expose content_hash + previous_entry_hash in API response (Gap 9)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
master
2026-04-09 12:09:27 +03:00
parent 2a69ad112c
commit 7f40f8d678
5 changed files with 78 additions and 4 deletions

View File

@@ -117,7 +117,8 @@ public sealed class PostgresUnifiedAuditEventStore
actor_id, actor_name, actor_email, actor_type, actor_ip, actor_user_agent,
resource_type, resource_id, resource_name,
description, details_jsonb, diff_jsonb,
correlation_id, parent_event_id, tags
correlation_id, parent_event_id, tags,
content_hash, previous_entry_hash
FROM timeline.unified_audit_events
ORDER BY timestamp DESC, id ASC
LIMIT 10000
@@ -151,7 +152,8 @@ public sealed class PostgresUnifiedAuditEventStore
actor_id, actor_name, actor_email, actor_type, actor_ip, actor_user_agent,
resource_type, resource_id, resource_name,
description, details_jsonb, diff_jsonb,
correlation_id, parent_event_id, tags
correlation_id, parent_event_id, tags,
content_hash, previous_entry_hash
FROM timeline.unified_audit_events
WHERE tenant_id = @tenantId
ORDER BY timestamp DESC, id ASC
@@ -429,7 +431,9 @@ public sealed class PostgresUnifiedAuditEventStore
Diff = DeserializeDiff(diffJson),
CorrelationId = reader.IsDBNull(18) ? null : reader.GetString(18),
ParentEventId = reader.IsDBNull(19) ? null : reader.GetString(19),
Tags = tagsArray
Tags = tagsArray,
ContentHash = reader.IsDBNull(21) ? null : reader.GetString(21),
PreviousEntryHash = reader.IsDBNull(22) ? null : reader.GetString(22)
};
}