Skip to content

[Refactor] Logging module SENSITIVE_KEYS includes email — valid audit data is over-redacted #781

Description

@RUKAYAT-CODER

Overview

src/lib/logging/index.ts defines SENSITIVE_KEYS with email in the list, causing redactObject() to replace all email fields with [REDACTED] in every log entry. This over-redacts audit-trail logs where the email is the actor identifier and is needed for security investigations, while not applying redaction in error reports containing form state where redaction is truly needed.

Specifications

Features:

  • email is not globally redacted from all log entries
  • Email addresses in form submission data and error reports are redacted contextually
  • Audit log entries retain the actor email where authorized

Tasks:

  • Remove email from the global SENSITIVE_KEYS list in src/lib/logging/index.ts
  • Add email redaction specifically in the error-report handler
  • Add email redaction in any handler that processes user-submitted form data
  • Update tests that assert [REDACTED] for email to reflect the new targeted behavior

Impacted Files:

  • src/lib/logging/index.ts
  • src/app/api/errors/report/route.ts

Acceptance Criteria

  • Audit log entries for user actions retain the actor email or ID
  • Error report logs have email fields replaced with [REDACTED]
  • SENSITIVE_KEYS does not include email at the global level

Metadata

Metadata

Assignees

Labels

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