Log Redaction
On this page
Why Redaction Is Critical
Logs often end up in centralized systems and long-term storage. Accidentally logging secrets creates compliance and security risks.
What to Redact
- Passwords
- Access tokens
- Refresh tokens
- Credit card numbers
- National IDs
Redaction Strategy
Implement a log serializer that masks sensitive fields before output.
function redact(obj) {
if (obj.password) obj.password = '[REDACTED]';
if (obj.token) obj.token = '[REDACTED]';
return obj;
}
Production Guidance
Prefer allowlisting safe fields rather than blacklisting sensitive ones. Assume input may contain secrets even if you did not expect it.