Skip to content

Add password hash exclusion from GDPR data export response #880

Description

@RUKAYAT-CODER

Overview

src/modules/gdpr/gdpr.service.ts exportUserData() builds the export from the user entity. If the serialization does not explicitly exclude password (bcrypt hash), refreshToken, and passwordHistory, these fields are returned in the GDPR Subject Access Request response and could be used for offline hash-cracking attacks.

Specifications

Features:

  • GDPR export must explicitly exclude all credential-related fields.

Tasks:

  • Create a GdprExportDto with @Exclude() on password, refreshToken, passwordHistory, totpSecret, and token columns.
  • Map the user entity to this DTO before returning the export.
  • Add a unit test asserting these fields are absent from the export response.

Impacted Files:

  • src/modules/gdpr/gdpr.service.ts
  • New src/modules/gdpr/dto/gdpr-export.dto.ts

Acceptance Criteria

  • GDPR export response does not include password, refreshToken, or passwordHistory.
  • All other PII fields (name, email, enrollments) are present.
  • Unit test verifies field exclusion.

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