You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As an enterprise security officer I want comprehensive, tamper-evident audit logs for all KB operations So that I can ensure compliance with enterprise security policies and investigate security incidents
Where: Knowledge service — enhanced audit subsystem extending Epic #66 foundation
Refined: Story is detailed, estimated, and ready for development
In Progress: Story is actively being developed
Done: Story delivered and accepted
Acceptance Criteria
Functional Requirements
Given the basic audit logging from Epic Centralized Knowledge Service #66 (Audit Logs for KB Operations #154) is in place When an enterprise security officer queries GET /api/v1/organizations/acme/audit-logs/verify Then the service verifies hash chain integrity and returns { "status": "valid", "entries_verified": N, "range": { "from": "...", "to": "..." } }
Given audit log entries are stored with hash chain When any entry is tampered with (modified, deleted, inserted) Then the integrity verification endpoint detects the break: { "status": "invalid", "first_break_at": "...", "entry_id": "..." }
Given an enterprise admin with SIEM integration configured When audit events occur Then events are exported in CEF (Common Event Format) via webhook to configured SIEM endpoint in near-real-time
Given an enterprise admin requests a compliance report When they send GET /api/v1/organizations/acme/audit-logs/compliance-report?standard=soc2&period=2026-Q1 Then the service returns a structured report: total events, event type breakdown, access patterns, anomalies, failed auth count, data access summary
Given a configurable retention policy (e.g., 365 days for enterprise) When the retention period is set via org settings Then audit logs are retained for the configured period; after expiry, entries are archived to cold storage (S3) before deletion
Given the audit log API When any user queries it Then the query response includes X-Audit-Integrity: verified header confirming chain validity for the returned range
Business Rules
Hash chain: each entry includes prev_hash = SHA-256(previous_entry) — creates tamper-evident chain
Chain verification: O(n) scan from first to last entry in range, verify each hash link
SIEM export: webhook POST to configured URL with CEF-formatted events, retry with exponential backoff (3 retries)
Compliance report standards: SOC 2 Type II, GDPR (extensible)
Retention: configurable per org (30-365 days), default 90 days; archived entries moved to S3 before deletion
Unit tests for hash chain, verification, compliance report
Integration tests for end-to-end audit flow
Quality Assurance
Hash chain verification detects all tampering scenarios (modify, delete, insert)
SIEM export delivers events within 60s of occurrence
Compliance report generates in <30s for 1-year period
Archive/deletion does not affect active audit queries
Deployment and Release
S3 bucket for cold storage archival configured
SIEM webhook configuration documented
Compliance report templates reviewable
Story Sizing and Sprint Readiness
Refined Story Points
Final Story Points: XL(8) Confidence Level: Medium Sizing Justification: Extends #154 foundation with hash chain, SIEM integration, compliance reporting, cold archival. Each is a distinct subsystem. Moderate total effort.
Sprint Capacity Validation
Sprint Fit Assessment: Fits in single sprint Total Effort Assessment: Yes
Prerequisite Stories: Epic #66#154 (Audit Logs — foundation to extend) Dependent Stories: None
External Dependencies
Infrastructure Requirements: S3 cold storage bucket, SIEM endpoint for testing
Validation and Testing Strategy
Acceptance Testing Approach
Testing Methods: Unit tests for hash chain logic; integration tests: insert entries → tamper → verify → detect; mock SIEM endpoint for webhook testing Test Data Requirements: Seeded audit entries with known hash chain, tampered entries Environment Requirements: PostgreSQL test container, mock SIEM webhook, S3 mock for archival
Notes
Refinement Insights: Hash chain is the core innovation over basic audit logs. SIEM export and compliance reports are relatively straightforward on top of that.
Technical Analysis
Implementation Approach
Technical Strategy: Extend audit_logs table with prev_hash column. On insert, compute SHA-256 of previous entry's (id + action + timestamp + prev_hash) and store as current entry's prev_hash. Verification: iterate chain and recompute hashes. SIEM: webhook emitter triggered by audit event emitter. Compliance: SQL aggregation queries with report template. Key Components: Hash chain module, integrity verifier, SIEM webhook emitter, compliance report generator, archival cron job Data Flow: Audit event → compute hash chain → insert → emit to SIEM webhook → (async) archive expired entries to S3
Story Statement
As an enterprise security officer
I want comprehensive, tamper-evident audit logs for all KB operations
So that I can ensure compliance with enterprise security policies and investigate security incidents
Where: Knowledge service — enhanced audit subsystem extending Epic #66 foundation
Epic Context
Parent Epic: Platform Hardening & Enterprise Readiness #68
Status: Refined
Priority: P0 (Must-Have)
Status Workflow
Acceptance Criteria
Functional Requirements
Given the basic audit logging from Epic Centralized Knowledge Service #66 (Audit Logs for KB Operations #154) is in place
When an enterprise security officer queries GET
/api/v1/organizations/acme/audit-logs/verifyThen the service verifies hash chain integrity and returns
{ "status": "valid", "entries_verified": N, "range": { "from": "...", "to": "..." } }Given audit log entries are stored with hash chain
When any entry is tampered with (modified, deleted, inserted)
Then the integrity verification endpoint detects the break:
{ "status": "invalid", "first_break_at": "...", "entry_id": "..." }Given an enterprise admin with SIEM integration configured
When audit events occur
Then events are exported in CEF (Common Event Format) via webhook to configured SIEM endpoint in near-real-time
Given an enterprise admin requests a compliance report
When they send GET
/api/v1/organizations/acme/audit-logs/compliance-report?standard=soc2&period=2026-Q1Then the service returns a structured report: total events, event type breakdown, access patterns, anomalies, failed auth count, data access summary
Given a configurable retention policy (e.g., 365 days for enterprise)
When the retention period is set via org settings
Then audit logs are retained for the configured period; after expiry, entries are archived to cold storage (S3) before deletion
Given the audit log API
When any user queries it
Then the query response includes
X-Audit-Integrity: verifiedheader confirming chain validity for the returned rangeBusiness Rules
prev_hash = SHA-256(previous_entry)— creates tamper-evident chainEdge Cases and Error Handling
Definition of Done Checklist
Development Completion
Quality Assurance
Deployment and Release
Story Sizing and Sprint Readiness
Refined Story Points
Final Story Points: XL(8)
Confidence Level: Medium
Sizing Justification: Extends #154 foundation with hash chain, SIEM integration, compliance reporting, cold archival. Each is a distinct subsystem. Moderate total effort.
Sprint Capacity Validation
Sprint Fit Assessment: Fits in single sprint
Total Effort Assessment: Yes
Story Splitting Recommendations
Dependencies and Coordination
Story Dependencies
Prerequisite Stories: Epic #66 #154 (Audit Logs — foundation to extend)
Dependent Stories: None
External Dependencies
Infrastructure Requirements: S3 cold storage bucket, SIEM endpoint for testing
Validation and Testing Strategy
Acceptance Testing Approach
Testing Methods: Unit tests for hash chain logic; integration tests: insert entries → tamper → verify → detect; mock SIEM endpoint for webhook testing
Test Data Requirements: Seeded audit entries with known hash chain, tampered entries
Environment Requirements: PostgreSQL test container, mock SIEM webhook, S3 mock for archival
Notes
Refinement Insights: Hash chain is the core innovation over basic audit logs. SIEM export and compliance reports are relatively straightforward on top of that.
Technical Analysis
Implementation Approach
Technical Strategy: Extend audit_logs table with
prev_hashcolumn. On insert, compute SHA-256 of previous entry's (id + action + timestamp + prev_hash) and store as current entry's prev_hash. Verification: iterate chain and recompute hashes. SIEM: webhook emitter triggered by audit event emitter. Compliance: SQL aggregation queries with report template.Key Components: Hash chain module, integrity verifier, SIEM webhook emitter, compliance report generator, archival cron job
Data Flow: Audit event → compute hash chain → insert → emit to SIEM webhook → (async) archive expired entries to S3
Technical Requirements
audit_logstable: addprev_hash VARCHAR(64),entry_hash VARCHAR(64)columnsSHA-256(entry_id + action + actor + timestamp + resource_id + prev_hash)CEF:0|pair|knowledge-service|1.0|<action>|<description>|<severity>|...Technical Risks and Mitigation
Spike Requirements
Required Spikes: Evaluate single-writer pattern vs advisory lock for hash chain ordering under concurrent load