Deleted account content removed or attributed to anonymized placeholder
Why it matters
Deleting a user record while leaving their posts and comments attributed to the original user ID or username is a partial erasure that violates GDPR Art. 17. The username on a comment thread is PII — it identifies the person even after account deletion. CWE-212 (improper cross-boundary removal of sensitive data) captures this exact failure mode. Inconsistent handling across content types — posts anonymized but comments not, or media files left with original paths — compounds the exposure.
Severity rationale
High because content that retains original attribution after account deletion constitutes continuing PII exposure in violation of GDPR Art. 17, even if the user record itself was removed.
Remediation
Maintain a system-level DELETED_USER placeholder account and reassign all content to it atomically in the same transaction as the user row deletion. Handle every content type — posts, comments, likes, media, social graph edges — in a single function.
// src/lib/users/deleteContent.ts
async function deleteUserContent(userId: string) {
const ghost = await db.user.findUniqueOrThrow({ where: { username: 'DELETED_USER' } });
await db.$transaction([
db.post.updateMany({ where: { authorId: userId }, data: { authorId: ghost.id } }),
db.comment.updateMany({ where: { authorId: userId }, data: { authorId: ghost.id } }),
db.like.deleteMany({ where: { userId } }),
db.follow.deleteMany({ where: { OR: [{ followerId: userId }, { followingId: userId }] } }),
]);
}
If posts should be removed rather than preserved (forum vs. social context), swap updateMany for deleteMany, but choose one strategy and apply it consistently across all content types.
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 Community Privacy & Controls Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- gdpr · Art. 17 — Right to erasure ('right to be forgotten')
- cwe · CWE-212 — Improper Removal of Sensitive Information Before Storage or Transfer
- ccpa · §1798.105 — Right to delete personal information
- soc2:2017 · C1.2 — Disposal of confidential information
Taxons
History
- 2026-04-18·v1.0.0·Initial import from community-privacy-controls·automated
- 2026-07-06·v1.0.1·Add SOC 2 TSC mapping (C1.2) from the verified compliance crosswalk register (docs/compliance/).·by soc2-mapping-enrichment-ship-2