fix(core/http): filter sensitive data from logs and allow unauthenticated health checks - #85
fix(core/http): filter sensitive data from logs and allow unauthenticated health checks#85joelrb wants to merge 4 commits into
Conversation
Add filterSensitiveData() to prevent API keys, passwords, tokens, and other secrets from being logged. Filters common sensitive key patterns and recursively processes nested objects.
Allow health check endpoints to be accessed without authentication. This enables container orchestrators and load balancers to probe service health without requiring API keys.
|
Partial overlap with main now: the |
|
Closing as superseded. The /health endpoint is already public on current main, so that half of this PR landed independently. The remaining logger-redaction intent is covered more comprehensively by #253, which handles structured and fragmented credential redaction across logs and streams, sensitive-file permissions, and focused regression coverage. Thank you for surfacing both problems; the useful security intent is preserved in the newer work. |
Description
Problem
Two security-related issues found during code review:
Fix Applied
Logger sensitive data filtering - Added filterSensitiveData() function that recursively filters sensitive keys from log details. Filters keys containing: api_key, password, secret, token, authorization, auth, private_key, and any key containing "password", "secret", or "token" (case-insensitive). Replaces with [REDACTED].
Public health endpoint - Added /health to PUBLIC_PATHS in security middleware, allowing unauthenticated access for container orchestration health checks. Added normalization to handle trailing slashes.
Framework Change
None
Files Changed
Security Severity: Medium
Type of Change
Related Issues
Fixes #
Related to #
Testing
Describe the testing performed for this PR:
Include specific test scenarios or commands used.
Manual test:
Test 1: Logger filters sensitive data
Controller starts normally - API keys in logs now show as [REDACTED]
Test 2: Health endpoint allows unauthenticated access
curl http://localhost:8080/health
Returns 404 (no endpoint) instead of 401 (unauthorized)
Checklist
Performance & Security
Screenshots (if applicable)
Additional Notes
Logger filtering works recursively - nested objects in log details are also sanitized.