I am currently evaluating SonarCloud for code security needs and have come across an issue I am hoping to clarify.
During my analysis of a .NET code repository, I noticed that SonarCloud does not seem to detect secrets or credentials within the app config file. This file often contain sensitive information such as database connection strings or API keys, I was expecting SonarCloud to flag them if any secrets were present.
Could anyone please confirm if:
SonarCloud is able to detect secrets within these types of configuration files?
There are any specific settings or configurations I need to apply in order to enable this detection?
If this functionality is not currently supported, is it something that will be added in future releases?
I was hoping Sonar would flag the fact that my connection string contains a user ID and password, as these credentials should not be committed to the codebase.Sometimes developers may accidentally commit non-prod or prod secrets, so I want to avoid that risk.
I ran some tests and the detection seems to work when your example is included in a web.config file (a Security Hotspot is raised), but not in app.config files.
After double-checking on my side, it looks like the problem is not how the file is called but the actual secret inside it.
password=Password1234! looks “too fake”, so our analyzer doesn’t raise an issue on it to avoid noise and false-positive fatigue. If you try with a more “real-looking” password like password=NkhAL5M26YAt, it should raise an issue in your code.