What is needed
I would like other project files to be scanned for hard coded secrets. One example in a Java project would the application.properties
file.
Setup
On my branch there is a new file in the root called sonar-project.properties
with this content:
sonar.projectKey=my_project
sonar.sourceEncoding=UTF-8
sonar.maven.scanAll=true
pom.xml contains:
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>4.0.0.4121</version>
</plugin>
There is a Sonar workflow file as well: .github/workflows/sonar_cloud.yaml
with this step:
run: mvn -e -X -f pom.xml -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=my_project
This step runs when I commit a change to my branch.
Observations
I committed an application.properties
file with this line:
password.secret.key=mySecretRootAccess!@#$%
SonarCloud
SonarCloud reports no issues at all but I expected to report on the hard-coded password.
SonarQube for IDE
In my IntelliJ IDE, SonarQube for IDE for this file reports: This file is not automatically analyzed.
Looking at the SonarQube for IDE logs I see:
Trigger: BINDING_UPDATE
[BINDING_UPDATE] 4 file(s) submitted
File 'application.properties' excluded: file is classified as Java resource in project structure
Configuring analysis with org.sonarlint.intellij.java.JavaAnalysisConfigurator
I expect the file to be automatically analyzed.
When I manually trigger the SonarQube for IDE analyses in the IDEA, I see few other issues reported but not this particular line. Here are some examples of issues reported for other lines:
Google API keys should not be disclosed
Slack bot tokens should not be disclosed
Credentials should not be hard-coded
I expect the line with password.secret.key=mySecretRootAccess!@#$%
to be reported on but that is not the case.
Any help would be appreciated.
Thanks!