Skip to content

GDPR erasure does not cascade-delete financial records and active sessions #804

Description

@RUKAYAT-CODER

Overview

src/modules/gdpr/gdpr.service.ts eraseUserData() nulls profile fields but does not delete or anonymize payments, enrollments, audit logs, or active sessions. This creates orphaned financial records referencing a deleted profile and leaves active sessions usable after erasure.

Specifications

Features:

  • Erasure must anonymize/delete all PII across related tables within a database transaction.
  • All active sessions must be revoked on erasure.

Tasks:

  • Wrap the erasure in a TypeORM transaction.
  • Anonymize Payment, Enrollment, AuditLog, Notification records tied to the user.
  • Call SessionService.deleteAllUserSessions(userId) to revoke sessions.
  • Add a GdprErasureJob for async cascade processing with idempotency.
  • Add integration tests verifying no PII remains after erasure.

Impacted Files:

  • src/modules/gdpr/gdpr.service.ts
  • src/session/session.service.ts

Acceptance Criteria

  • No PII remains in any table after erasure.
  • Active sessions are immediately invalidated.
  • Repeated erasure calls are idempotent (no errors on second run).

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't workingsecurity

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions