Skip to content

Add helper for masking sensitive fields before writing objects to structured logs #569

Description

@Chucks1093

Summary

Structured logs occasionally include objects that contain sensitive fields like wallet addresses, callback URLs, or API keys. A shared masking helper that accepts an object and a list of field names to mask should be applied before any object is written to a log.

Scope

  • Add maskFields(obj: Record<string, unknown>, fields: string[]): Record<string, unknown> helper
  • Replaces the value of each named field with [REDACTED]
  • Works recursively for nested objects
  • Does not mutate the original object
  • Add unit tests for: top-level field masked, nested field masked, non-existent field ignored, original object unchanged

Acceptance Criteria

  • Named fields replaced with [REDACTED]
  • Nested fields masked correctly
  • Original object not mutated
  • Non-existent field names ignored without error

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26

Type

No type

Fields

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