Dear all, I have detected what I think is a false negative in rule S6418 “Secrets should not be hard-coded” and/or S2068 “Credentials should not be hard coded”.
Problem: Hardcoded password SuperSecretABCD1234!? not detected.
Context: I have run the scanner sonar-scanner-cli 8.1 against SonarQube Cloud Enterprise. The scanner logs show that the file with the password is indexed both in ansible and yaml sensors, the project is using SonarWay profiles in all languages, in which bot rules are activated. The file is analyzed for sure, because other issues of ansible have arisen.
Evidences:
Starting point: The file does not detect a hardcoded password. No issue is arisen nor credential nor secret.
vars:
app_db_password: "SuperSecretABCD1234!?"
tasks:
First change: Change the password and use some random string without the word “secret”. I get then an issue of the rule S2068 “password detected here” of the yaml language. This shows that yaml profile is being correctly applied.
vars:
app_db_password: "fawñeohkap93023Añgae`w3QR"
tasks:
Second change: Add the word “secret” as suffix of the random string. I get nothing again.
vars:
app_db_password: "secret_fawñeohkap93023Añgae`w3QR"
tasks:
I can understand that if the password has the word “secret” or “token” it is likely a test or demo password that maybe it is not a real secret. I do not know if this false negative is intentional (not a real false negative) because of this.
However, I think some issue should tell the developer that this password is hardcoded and cannot be written there. I do not really know which of those rules should arise (I will be inclined by S2068, since it is not a secret) but any of them would be necessary, whouldn`t be?
Best regards and thank you.