Every leaked secret I have seen started the same way. Someone wrote logger.info({ user }) , the code looked harmless, and user carried a session token. Now that token lives in the log aggregator, the error tracker and a few vendors' systems, for as long as they keep logs.
Most loggers have an answer for this. pino has a redact option, and you can write a winston format. Both work the same way: you list the paths that are sensitive, and those fields are masked.
The trouble is the list. It only covers what you remembered. The leak is always somewhere else:
a free-text note field where a customer pasted an API key
a nested payload from a third-party SDK you never looked inside
an error message that includes the request URL, with a token in the query string
Read the values, not the names
I built flare-redact to check the content itself.…