feat: key-activity audit events for recovery + invitation transitions (task 1.8, KEY-12/NFR-06) #67
No reviewers
Labels
No labels
epic
phase-0
phase-1
phase-2
phase-3
phase-4
phase-5
phase-6
phase-7
phase-8
phase-9
priority/P0
priority/P1
priority/P2
type/backend
type/client
type/docs
type/ops
type/security
type/spike
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/failsulit!67
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/1.8-key-audit-events"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #23 — task 1.8 audit-events gap closure (KEY-12, NFR-06, ADM-04).
Gap found: ORG/KEY/pairing/wrap/device transitions were already audited (tasks 1.2–1.7); the recovery-request lifecycle had ZERO admin-audit coverage (the "recovery.request"/"recovery.approved" strings in handlers are in-app notification titles, not audit events), and invitation acceptance (INV group per NFR-06) was unaudited.
Adds 5 events via existing AuditService:
recovery.requested— CreateRecoveryRequest (public DID path) + InitiateRecoveryRequest (settings path), actor=requesterrecovery.request.approved— on the threshold flip Pending→Approved only, actor=tipping trusteerecovery.trustee_rejected— trustee rejection decision (naming follows recovery.rekey_rejected style)recovery.completed— CompleteRecovery success (alongside existing activity-feed row)invitation.accepted— in InvitationAcceptanceService (single choke point, all 4 accept paths), atomic with the claim transaction (logged before commit)KEY-12 acceptance: events in admin audit log with actor + device id — wrap/pairing/device events already carry device ids (verified, no change needed).
TDD: 6 red tests first (4 TrusteeRecoveryTests + 1 RecoveryShamirTests + 1 InvitationAcceptanceServiceTests), then green. Suite 798/0/39 Release ×3; coverage gate 82.88% ≥ 80.
Also fixes a latent test footgun discovered en route: POST /api/invitations/{id}/accept with a null body 400s at model binding (Request record) — new test uses an empty JSON body.