Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warn on Logging security Info

I'm so worried about people logging confidential information to server logs. I have seen server logs in production. Some developers are accidentally logging security related information like password, clientId, clientSecret etc.

Is there any way, like Eclipse plugin or any tool, to warn developers while writing their code?

 `ex : log.info("usernam = " + username + "password = " + password) ;` // 
Warn that confidential info is getting logged.

I have done some research... I have seen tools like sonarLint and FindBug

but those plugins are unable to solve my problem.

like image 505
kavetiraviteja Avatar asked Apr 12 '17 06:04

kavetiraviteja


People also ask

What are logs in information security?

A log is a record of the events occurring within an organization's systems and networks. Logs are composed of log entries; each entry contains information related to a specific event that has occurred within a system or network. Many logs within an organization contain records related to computer security.

What kind of information should you keep in logs?

These logs typically consist of the following information: date and time, requester identity such as User ID and IP address or referral URL, and the actual request data. In the case of a Web Application or API, the requested endpoint URL and context header and body is logged.

Why is log review important for security operations?

From a security point of view, the purpose of a log is to act as a red flag when something bad is happening. Reviewing logs regularly could help identify malicious attacks on your system. Given the large of amount of log data generated by systems, it is impractical to review all of these logs manually each day.


1 Answers

SonarLint offers the rule S2068: Credentials should not be hard-coded, which targets the use of hard-coded credentials, and it seems close to what you are trying to achieve, though it may be not enough for your needs.

As stated in other answers, however, identifying such security holes can be ultimately hard and strong code reviews is certainly a good move to reduce the risks.

Now, if you really fear about usages of loggers, already knows potential issues, and what data could leak, I would suggest to write your own Java Custom Rule for SonarQube.

Custom rules are supported by SonarLint and can be applied at enterprise level once the Custom Plugin containing it is deployed on a SonarQube server. This solution would allow you to explicitly define what you want to target, and fine-tune a rule depending on your needs and enterprise specifics. Writing such rules is not hard and documented in the following tutorial: Custom rules for Java.

like image 200
Wohops Avatar answered Sep 17 '22 11:09

Wohops