Skip to content

[HIGH] — EmailService.send logs the full rendered HTML body to console in development; may leak PII into log streams #4

Description

@Alqku

Severity: High
Type: Security hardening
Scope: Notifications
Labels: security, good first issue

Description

EmailService.send (src/notifications/email.service.ts, lines ~98–110) calls transporter.sendMail and, when the JSON transport is used (the dev fallback), it then logs the full message body via this.logger.debug(\Email body preview: ${(info as any).message}`). The (info as any).message` payload includes recipient addresses, subject, and full HTML, which frequently contains donor names, campaign titles, and donation amounts.

Even if intended only for debug level, default NestJS log level can be raised by LOG_LEVEL=debug in non-production environments; once collected by a log shipper (Datadog, Loki, CloudWatch), the body leaves the application boundary.

Recommendation

  • In dev mode, log only the subject and recipient, never the HTML body.
  • Mask any user-identifying fields (donor name, email) before logging the structured preview line.
  • If a body preview is genuinely useful in dev, gate it behind an explicit EMAIL_PREVIEW=1 env flag and never honour it when NODE_ENV=production.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignAudit finding under the Official Campaigngood first issueGood for newcomerssecuritySecurity vulnerability or hardening

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