Phase 1, Task 4: Audit Logging Framework #17

Closed
opened 2026-03-30 09:22:31 +02:00 by claude · 0 comments
Owner

Plan Reference

docs/superpowers/plans/2026-03-29-phase-1-foundation-auth.md → Task 4

Scope

  • V004: audit_log table (append-only, JSONB metadata, indexed by tenant/actor/action)
  • AuditAction enum (auth, tenant, app, secrets, config, team actions)
  • AuditEntity JPA entity with @PrePersist timestamp
  • AuditRepository (no delete/update methods exposed)
  • AuditService with log() method
  • Unit tests (AuditServiceTest) + integration tests (AuditRepositoryTest with TestContainers)

SOC 2 Note

This is the foundation for SOC 2 audit trail. The table is designed as append-only — no UPDATE/DELETE grants in production.

Steps

  • Create V004 migration (audit_log table)
  • Write failing unit tests for AuditService
  • Run tests — verify failure
  • Implement AuditAction, AuditEntity, AuditRepository, AuditService
  • Run unit tests — verify pass
  • Write integration tests for AuditRepository
  • Run integration tests — verify pass
  • Commit

Depends On

  • #16 (Task 3: Flyway Migrations)
  • #11 (Security & SOC 2 Compliance)
## Plan Reference `docs/superpowers/plans/2026-03-29-phase-1-foundation-auth.md` → Task 4 ## Scope - V004: `audit_log` table (append-only, JSONB metadata, indexed by tenant/actor/action) - `AuditAction` enum (auth, tenant, app, secrets, config, team actions) - `AuditEntity` JPA entity with `@PrePersist` timestamp - `AuditRepository` (no delete/update methods exposed) - `AuditService` with `log()` method - Unit tests (AuditServiceTest) + integration tests (AuditRepositoryTest with TestContainers) ## SOC 2 Note This is the foundation for SOC 2 audit trail. The table is designed as append-only — no UPDATE/DELETE grants in production. ## Steps - [ ] Create V004 migration (audit_log table) - [ ] Write failing unit tests for AuditService - [ ] Run tests — verify failure - [ ] Implement AuditAction, AuditEntity, AuditRepository, AuditService - [ ] Run unit tests — verify pass - [ ] Write integration tests for AuditRepository - [ ] Run integration tests — verify pass - [ ] Commit ## Depends On - #16 (Task 3: Flyway Migrations) ## Related Epics - #11 (Security & SOC 2 Compliance)
claude added the phase-1securitytask labels 2026-03-30 09:23:13 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cameleer/cameleer-saas#17