We are facing an issue with SonarCloud analysis where plain-text (.txt) files are not being covered by the scan. One of these .txt files contains a hardcoded secret in plain text, but no security finding is being generated.
From the scanner logs, we observed the following configuration:
Project configuration:
Excluded sources: **/node_modules/**, **/.git/**, **/build-wrapper-dump.json, **/*.txt
Included tests: **/*.txt
The .txt files appear under Excluded sources and are also being treated as Included tests. Due to this behavior, the files containing hardcoded secrets are not being analyzed as expected.
We have attempted to include the files in the analysis using configurations such as:
# Include TXT files for text/secrets analysis
sonar.text.inclusions.activate=true
sonar.text.inclusions=\*\*/\*.txt
However, the .txt files are still not being covered by the SonarCloud scan as expected, and the hardcoded secrets remain undetected.
Expected behavior:
We would like SonarCloud to:
- Include .txt files in the scan.
- Perform Secrets analysis on these files.
- Report hardcoded secrets when they match supported secret-detection rules.
Could you please help us confirm:
- Why are **/*.txt files automatically appearing under Excluded sources and Included tests?
- How can we configure SonarCloud so that .txt files are included in the appropriate analysis scope?
- Is any additional configuration required to enable secret detection for .txt files?
- Are there any limitations on the types of hardcoded credentials/secrets that SonarCloud can detect in .txt files?
Please advise on the recommended configuration to ensure that .txt files are scanned and hardcoded secrets within them are detected.