Leakage of sensitive information in logger message
- Rule ID: java_lang_logger
- Languages: java
- Source: logger.yml
Description
Leaking sensitive data to loggers is a common cause of data leaks and can lead to data breaches. This rule looks for instances of sensitive data sent to loggers.
Remediations
❌ Avoid using sensitive data in logger messages:
logger.info(user.email)
✅ If you need to identify a user, use their unique identifier instead of their personal identifiable information:
logger.info(user.uuid)
✅ Ideally, do not log dynamic variables or attributes as this could lead to unintentional information leakage down the line
logger.info("user signed in")
Resources
Associated CWE
OWASP Top 10
Configuration
To skip this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --skip-rule=java_lang_logger
To run only this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --only-rule=java_lang_logger