Skip to content

feat(logger): add centralized sensitive field redaction to logs (#691) - #731

Open
ravendevhub wants to merge 1 commit into
Core-Foundry:mainfrom
ravendevhub:feat/log-redaction-policy-691
Open

feat(logger): add centralized sensitive field redaction to logs (#691)#731
ravendevhub wants to merge 1 commit into
Core-Foundry:mainfrom
ravendevhub:feat/log-redaction-policy-691

Conversation

@ravendevhub

Copy link
Copy Markdown

Summary

Resolves #691 by implementing a centralized redaction policy and sanitizer engine (listener/src/utils/redact.ts) ensuring API keys, passwords, webhook URLs, bearer tokens, and Stellar secret keys are systematically sanitized before being emitted to log outputs.

Changes

  1. Redaction Engine (listener/src/utils/redact.ts):
    • Detects and masks sensitive object keys (password, secret, authorization, api_key, webhook_url, etc.).
    • Redacts string patterns: Bearer tokens (Bearer [REDACTED]), Discord webhooks (https://discord.com/api/webhooks/[REDACTED_WEBHOOK_URL]), and Stellar secret keys (S[REDACTED_STELLAR_SECRET_KEY]).
    • Recursively sanitizes Error instances, nested causal chains, and stack traces.
  2. Logger Integration (listener/src/utils/logger.ts):
    • Automatically passes message strings and metadata through redactSensitiveData before formatting.
  3. Tests & Documentation:
    • Comprehensive test suite in redact.test.ts verifying object, string, error, and circular reference redactions.
    • Specification documented in docs/SENSITIVE_FIELD_REDACTION.md.

Acceptance Criteria

  • Sensitive fields have a defined redaction policy.
  • Redaction is applied consistently.
  • Error logging does not bypass the policy.
  • Tests verify that representative secrets are not emitted.

…-Foundry#691)

- Define sensitive key patterns (passwords, secrets, auth tokens, api keys, webhook URLs)
- Redact embedded Bearer tokens, Discord webhook URLs, and Stellar secret keys from strings
- Sanitize Error objects, nested causal chains, and stack traces before log emission
- Add test suite in redact.test.ts and documentation in docs/SENSITIVE_FIELD_REDACTION.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Sensitive Field Redaction to Logs

1 participant