Archived
POPIA toolkit part 3: retention, breach register, readiness
- Retention policies (Admin -> Privacy -> Retention) applied by a nightly
`retention` job: inactive accounts anonymised after 5 years with a
30-day warning (on by default; never staff roles or people with an
upcoming registration), form answers, login history, payer details in
payment notifications, audit/access logs
- User.lastLoginAt (set on login, backfilled) and inactivityWarnedAt
- Breach register (SecurityBreach) with drafts for the people affected
and the Information Regulator
- Readiness checklist with a score
- Children's/medical flag in the access log; {retention} placeholder in
the privacy notice
- Unit tests (retention.test.js), e2e (privacy-retention.spec.ts); docs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012mt6TCv85T9VKRq3cV7rXq
This commit is contained in:
@@ -84,6 +84,10 @@ model User {
|
||||
// The privacy notice version they last accepted (0 = the built-in notice). Null = never
|
||||
// recorded. Asked again when a version that needs re-acceptance is newer.
|
||||
noticeVersionAccepted Int?
|
||||
// Retention: when they last logged in (kept here because login history itself expires),
|
||||
// and when they were warned that their inactive account is about to be deleted.
|
||||
lastLoginAt DateTime?
|
||||
inactivityWarnedAt DateTime?
|
||||
registrations Registration[]
|
||||
payments Payment[]
|
||||
paymentsRecorded Payment[] @relation("PaymentRecordedBy")
|
||||
@@ -136,6 +140,7 @@ model User {
|
||||
noticesPublished PrivacyNotice[]
|
||||
noticeAcceptances NoticeAcceptance[]
|
||||
dataAccessLogs DataAccessLog[]
|
||||
breachesRecorded SecurityBreach[]
|
||||
}
|
||||
|
||||
model Event {
|
||||
@@ -593,6 +598,10 @@ enum AdminAuditAction {
|
||||
operator_created
|
||||
operator_updated
|
||||
operator_deleted
|
||||
retention_policies_updated
|
||||
retention_run
|
||||
breach_recorded
|
||||
breach_updated
|
||||
}
|
||||
|
||||
// Append-only audit trail for admin/supervisor-initiated actions with money or
|
||||
@@ -1724,6 +1733,8 @@ model DataAccessLog {
|
||||
what String
|
||||
eventId String?
|
||||
records Int?
|
||||
// Children's or special personal information (youth events, medical details).
|
||||
sensitive Boolean @default(false)
|
||||
ip String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@ -1731,3 +1742,37 @@ model DataAccessLog {
|
||||
@@index([actorId, createdAt])
|
||||
@@index([action, createdAt])
|
||||
}
|
||||
|
||||
enum BreachStatus {
|
||||
open
|
||||
contained
|
||||
closed
|
||||
}
|
||||
|
||||
// POPIA s22: a security compromise — what happened, whose information, what was done, and
|
||||
// when the Information Regulator and the people affected were told.
|
||||
model SecurityBreach {
|
||||
id String @id @default(uuid())
|
||||
title String
|
||||
status BreachStatus @default(open)
|
||||
discoveredAt DateTime
|
||||
occurredAt DateTime?
|
||||
description String
|
||||
dataAffected String
|
||||
peopleAffected Int?
|
||||
// Free text: who (groups of people, events…), since a breach can involve people without accounts.
|
||||
whoAffected String?
|
||||
consequences String?
|
||||
actionsTaken String?
|
||||
adviceToPeople String?
|
||||
// Who caused it, if known (POPIA asks for this when notifying).
|
||||
causedBy String?
|
||||
regulatorNotifiedAt DateTime?
|
||||
peopleNotifiedAt DateTime?
|
||||
createdById String?
|
||||
createdBy User? @relation(fields: [createdById], references: [id], onDelete: SetNull)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([status, discoveredAt])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user