Skip to content

Security logging policy ​

Application logs and security audit events have different purposes. Audit events remain available for incident response, while application logs must not contain reusable credentials or raw personal data.

Allowed at Information and Warning:

  • user, tenant and operation identifiers;
  • security event type and decision;
  • non-reversible correlation values produced by SensitiveDataMasker.HashForLog.

Prohibited at every level:

  • passwords, access tokens, refresh tokens and Authorization values;
  • claim values or complete claim collections;
  • raw email, CPF, CNPJ, phone, name, IP or device fingerprint;
  • Redis keys and cached values.

Use the matching SensitiveDataMasker function when sensitive context is strictly necessary. JTI values are logged and audited only as a hash.

Login diagnostics ​

Login diagnostics retain the existing decision, reason and severity. For a located account, use its UserId; for an unknown account, log the event without the submitted email. Investigate attempts using the existing request or trace correlation identifier together with UserId when available. Keep internal logs access-controlled, and never add the submitted address to a formatted message or structured property.

Serilog configurations must include .Destructure.ByMaskingProperties(). SensitiveDataDestructuringPolicy redacts known credential properties when an object is destructured, providing a final safety boundary in addition to safe message templates.

Trace attributes ​

TelemetryBehavior records request operation, tenant and user identifiers, but never reads an Email property from a request. This keeps addresses submitted by anonymous login and password-reset requests out of trace attributes. The UserEnricher may add an email from the trusted authenticated IAuditContext; that value is masked before it is added as user.email.

This source policy does not sanitize values added by arbitrary host-provided telemetry enrichers, baggage, or exception messages and events. Hosts must keep those values free of raw personal data and secrets. Do not copy request email to another trace attribute, event, baggage item, or log, and do not use it as a high-cardinality metric label.

Updated at:

Released under the MIT License.