Description
Passwords, tokens and session IDs written to a log or standard output can reach log collectors.
Potential impact
Anyone who can read a console, collector or incident report may find credentials there and reuse them while they remain valid.
Remediation
Omit credentials, including Authorization header values, from log messages and structured fields. If a field must appear, replace its value with a fixed marker.
Examples
Before
go
log.Printf("password=%s", password)
After
go
log.Printf("password=<redacted>")
The revised log.Printf writes password=<redacted> without passing the password to the logger.