Skip to content
Ameen Abozaid
In reviewJNR-006-L05

Sensitive data in logs

  • Lesson 5 of 7
  • 11 min read
  • Junior
On This Lesson 4 topics

The content for this lesson is written and waiting for review. The outline below shows what it covers. It will be published once it is approved.

In this lesson

keep secrets and personal data out of logs.

Planned topics

  • Logs are copied, stored, and read by many people.
  • Never log passwords, tokens, API keys, full card numbers, or national IDs.
  • Mask what you must show: **** **** **** 1111.
  • Be careful with toString() of objects: it may include secrets.
  • Review log statements in code review.
Draft outline details

Demonstration

java
log.info("Charging card {}", mask(cardNumber)); // **** **** **** 1111

Check your understanding

May you log a password "just for debugging"?

Show answer

No, never.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.