Account deletion cascades to AI conversation data
Why it matters
GDPR Article 17 (Right to Erasure) and CCPA §1798.105 require that deletion of a user's account removes all associated personal data — not just the primary user record. CWE-459 (Incomplete Cleanup) covers exactly this pattern: a delete operation that removes the primary entity but leaves related records orphaned. AI conversation history typically contains some of the most sensitive personal data in the system — verbatim user statements about their problems, circumstances, and intentions. Orphaned conversation records after account deletion mean the user's data persists in the database indefinitely under a now-deleted user ID, violating the erasure right and potentially creating ghost data that can be queried without ownership context.
Severity rationale
Info because cascade delete configuration is a correctness issue rather than an exploitable vulnerability, but orphaned AI data after account deletion constitutes a documented GDPR Art. 17 compliance gap.
Remediation
Configure database-level cascade deletes so conversation records are automatically removed when the parent user is deleted — no application code change required for each new deletion path.
// schema.prisma
model Conversation {
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}
If explicit deletion is required (e.g., audit requirements demand a logged deletion event), use a transaction in your account deletion action:
await db.$transaction([
db.message.deleteMany({ where: { conversation: { userId } } }),
db.conversation.deleteMany({ where: { userId } }),
db.user.delete({ where: { id: userId } })
])
Verify by writing an integration test: create a user, add conversations, delete the user, and assert db.conversation.count({ where: { userId } }) returns 0.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the AI Data Privacy Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- gdpr · Art. 17 — Right to erasure — full cascade on account deletion
- ccpa · §1798.105 — Right to delete — service providers must comply
- cwe · CWE-459 — Incomplete Cleanup
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-data-privacy·automated