I have been trying to detect hard coded passwords in source code files.
Currently I am checking for variable assignments and comparison for identifiers with a sub-string matching with password,pswd.
But it is leading to lots of false positives like in this case(Reading passwords from a config file)
String PASSWORD_KEY = "server.password";
String password = prop.getProperty(PASSWORD_KEY);
I can flag out some sub-strings like Key,location,path for which i can skip the error generation but apart from this I cannot think of a better approach.
All suggestions are appreciated.