I am trying to detect hardcoded passwords in source code files.
I am currently checking the assignment of variables and the comparison for identifiers with the substring corresponding to the password, pswd.
But this leads to many false positives, similar in this case (reading passwords from the configuration file)
String PASSWORD_KEY = "server.password"; String password = prop.getProperty(PASSWORD_KEY);
I can mark some substrings, such as Key, location, path, for which I can skip the error generation, but apart from this I can not come up with a more suitable approach.
All suggestions are welcome.
source share