Skip to content

Security: Implement Secure Audit Trail with Immutable Event Log #518

Description

@Smartdevs17

Context

Compliance requirements (SOC2, PCI-DSS) demand tamper-evident audit logs for all sensitive operations.

Current Limitation/Problem

Audit logs are stored in a regular database table that can be modified by database administrators or through SQL injection. There is no tamper evidence.

Expected Outcome

An immutable audit trail using a hash chain where each log entry contains the hash of the previous entry, with periodic hash anchors to a public blockchain.

Acceptance Criteria

  • All sensitive operations logged: auth, payment, configuration changes, admin actions
  • Each log entry contains: { id, timestamp, actor, action, resource, details, previousHash, hash }
  • Hash chain: hash = SHA256(previousHash + timestamp + actor + action + resource + details)
  • Periodic anchor: append latest hash to public blockchain (Ethereum or Stellar) as proof
  • Verification tool: verify audit log integrity from genesis
  • Query performance: index on timestamp, actor, action for search
  • Log retention: hot (30 days in DB), warm (1 year in S3), cold (7 years in Glacier)
  • Tamper detection alert when hash chain inconsistency found
  • Export audit log for compliance review

Technical Scope

  • backend/src/audit/ - audit service
  • backend/src/audit/immutable-logger.ts - hash chain logger
  • backend/src/audit/chain-verifier.ts - integrity verification
  • backend/src/audit/anchor-service.ts - blockchain anchoring
  • Prisma: AuditLog model (hash chain)
  • S3 archiver for warm/cold storage
  • Frontend: /admin/audit-log - audit log viewer with verification
  • Edge cases: hash collision, blockchain anchor cost, concurrent log writes, log pruning

Metadata

Metadata

Assignees

Labels

200-points200 point issueStellar WaveIssues in the Stellar wave programdrips-waveIssues in the Drips Wave programhighHigh complexity issue

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions