DEV Community

Serguey Asael Shinder
Serguey Asael Shinder

Posted on

Don't Log the Thing You're Protecting

You encrypted it in the database.
You guarded it in transit.
Then you printed it to a log file
in plain text, forever.

Logs feel harmless.
They're just debugging, right?

They're also a copy —
of passwords, tokens, card numbers,
whatever you were so careful with
everywhere else.

Logs get shipped to third parties.
They sit on disks nobody guards.
They get pasted into tickets.

The secret you protected in ten places
leaks from the one place you forgot.

Before you log it, ask:
would I hand this line to a stranger?

Redact at the source.
The safest data
is the data you never wrote down.

– Serguey Asael Shinder

Top comments (0)