Warn on Logging security Info

kavetiraviteja :

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.

Michael - SonarSource Team :

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.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=473016&siteId=1