feat: admin audit log (recording, storage, Audit log screen) #21

Merged
ngqile merged 11 commits from add-admin-audit-log into main 2026-11-30 09:17:38 +00:00
Owner

Implements OpenSpec change add-admin-audit-log (design: docs/superpowers/specs/2026-11-30-admin-audit-log-design.md).

What

  • Recording (mobile-api AppAccessAspect): every non-GET /api/admin/** call with a valid admin token, plus @Audited sensitive reads (lead export, event-lead export, email view), is published as an AuditEvent to audit-event-topic. Refused attempts (403) are recorded as FAILURE. Auth endpoints are skipped except first-login. Best effort: a publish failure never changes the response.
  • Allow-listed changes: user roles/enabled and login-security settings before/after; role module grants added/removed; lead and event-lead edits record changed field names only, never values. The target is the last path variable; the unlock username is never recorded.
  • Storage (services-log): service-log.audit_event, listener, daily purge (AUDIT_RETENTION_DAYS, default 730, must be ≥ 1), POST /log/audit/search and GET /log/audit/{id}.
  • Read API: GET /api/admin/audit-log[/{id}] under BO_AUDIT_LOG.
  • Portal: /audit-log list (filters: who, module, action, outcome, dates) and /audit-log/[id] detail with the changes table; GET-only proxy.
  • Deploy: sql/01-audit-event.sql, sql/02-audit-log-module.sql, sql/99-rollback.sql; topic in local/pubsub/topics.txt; docs/deployment.md sections 3, 5 and 6.

Verification

  • Maven verify (core-libs, services-log, mobile-api): green. Portal: vitest 1258/1258, tsc, lint and build green.
  • Every task passed an Opus review gate; whole-branch Opus review READY, and its two important findings are fixed in 7aa5c4b.
  • Live on the local stack: events stored with every field; search, 400 and 404 through the gateway; purge keeps rows inside retention.
  • Playwright: user roles, role grants, lead edit, email view and export each appear with their changes and client IP; noevents is recorded as FAILURE 403, has no menu entry, and sees Not authorised; the list fits at 1280 px and works at 360 px.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM

Implements OpenSpec change `add-admin-audit-log` (design: `docs/superpowers/specs/2026-11-30-admin-audit-log-design.md`). ## What - **Recording (mobile-api `AppAccessAspect`):** every non-GET `/api/admin/**` call with a valid admin token, plus `@Audited` sensitive reads (lead export, event-lead export, email view), is published as an `AuditEvent` to `audit-event-topic`. Refused attempts (403) are recorded as `FAILURE`. Auth endpoints are skipped except first-login. Best effort: a publish failure never changes the response. - **Allow-listed changes:** user roles/enabled and login-security settings before/after; role module grants added/removed; lead and event-lead edits record changed field names only, never values. The target is the last path variable; the unlock username is never recorded. - **Storage (services-log):** `service-log`.`audit_event`, listener, daily purge (`AUDIT_RETENTION_DAYS`, default 730, must be ≥ 1), `POST /log/audit/search` and `GET /log/audit/{id}`. - **Read API:** `GET /api/admin/audit-log[/{id}]` under `BO_AUDIT_LOG`. - **Portal:** `/audit-log` list (filters: who, module, action, outcome, dates) and `/audit-log/[id]` detail with the changes table; GET-only proxy. - **Deploy:** `sql/01-audit-event.sql`, `sql/02-audit-log-module.sql`, `sql/99-rollback.sql`; topic in `local/pubsub/topics.txt`; `docs/deployment.md` sections 3, 5 and 6. ## Verification - Maven verify (core-libs, services-log, mobile-api): green. Portal: vitest 1258/1258, tsc, lint and build green. - Every task passed an Opus review gate; whole-branch Opus review READY, and its two important findings are fixed in 7aa5c4b. - Live on the local stack: events stored with every field; search, 400 and 404 through the gateway; purge keeps rows inside retention. - Playwright: user roles, role grants, lead edit, email view and export each appear with their changes and client IP; `noevents` is recorded as FAILURE 403, has no menu entry, and sees Not authorised; the list fits at 1280 px and works at 360 px. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
ngqile added 11 commits 2026-11-30 09:17:35 +00:00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
ngqile merged commit 518901a6d8 into main 2026-11-30 09:17:38 +00:00
ngqile deleted branch add-admin-audit-log 2026-11-30 09:17:39 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ngqile/co-lite#21