which versions are you using (SonarQube Server / Community Build, Scanner, Plugin, and any relevant extension) 25.3.0.104237
how is SonarQube deployed: zip
what are you trying to achieve : secret detection like api_key, API_KEY, PASSWORD in ini files and .py files on my local mac
what have you tried so far to achieve this : I tried doing secret detection in my example.py script and test.ini files but sonarqube fails to detect such sensitive content although i have properly defined qualitygate and qualityprofile but 0 vulnerabilities are reported as part of sonar-scanner
can you please clarify is secret detection is available in community edition ? if not, could you guide me on which edition i would need to access this feature ?
Do not share screenshots of logs â share the text itself (bonus points for being well-formatted)!
As mentioned i have configured properly Quality profile to use those 29 rules, but Sonarqube community edition only detects sensitive content like âaws-secret-access-keyâ as part of the code python or java file but not in any non code file like config.ini, properties file . sensitive content can be in non code files also and not necessarily always in language specific files .py , .java etc
so for file like below config.ini which exists along with python files , then sonarqube is having limited ability to detect only in .py file âaws-secret-access-keyâ but not in config.ini
Also sonarqube example in secrets example say same , please see screenshot
screenshot gives example of a code and not from non code file
You can also add this at the instance-level if you want to configure this for all projects (just navitage to the same setting in the global Administration).
Thanks for your reply. Please see screenshots and kindly help please.
Please see below log
I have configured and checked my project settings and as well administrator settings that properties âsonar.text.activateâ and âsonar.text.inclusionsâ are activated but it does not detect my files like config.ini, *.pem files
Also I have cloned all files from git on my local terminal before running below command
Please advise if there are any other params which we need to enable while running sonar-scanner so that files like config.ini can be picked up.
Why does for âquality gate secretsâ, it says never used.
Also in sonar-scanner logs it says âconfig.iniâ indexed with no language.
Any idea ?
22:42:24.053 DEBUG 14 non excluded files in this Git repository
22:42:24.079 INFO 1 language detected in 12 preprocessed files
22:42:24.079 INFO 0 files ignored because of scm ignore settings
22:42:24.081 INFO Loading plugins for detected languages
22:42:24.082 DEBUG Detected languages: [py]
22:42:24.082 INFO Load/download plugins
22:42:24.092 INFO Load/download plugins (done) | time=10ms
22:42:24.092 DEBUG Optional language-specific plugins not loaded: [csharp, flex, go, web, javasymbolicexecution, java, javascript, kotlin, php, ruby, sonarscala, vbnet, xml]
22:42:24.095 DEBUG Plugins loaded:
22:42:24.096 DEBUG * Python Code Quality and Security 5.0.0.20426 (python)
22:42:24.159 INFO Load project repositories
22:42:24.159 DEBUG --> GET http://localhost:9000/batch/project.protobuf?key=check_secret
22:42:24.166 DEBUG <-- 200 http://localhost:9000/batch/project.protobuf?key=check_secret (7ms, 288-byte body)
22:42:24.272 INFO Load project repositories (done) | time=114ms
22:42:24.284 DEBUG Available languages:
22:42:24.284 DEBUG * Python => "py"
22:42:24.284 DEBUG * IPython Notebooks => "ipynb"
22:42:24.285 DEBUG * Terraform => "terraform"
22:42:24.285 DEBUG * CloudFormation => "cloudformation"
22:42:24.285 DEBUG * Kubernetes => "kubernetes"
22:42:24.285 DEBUG * Docker => "docker"
22:42:24.285 DEBUG * AzureResourceManager => "azureresourcemanager"
22:42:24.286 DEBUG * YAML => "yaml"
22:42:24.286 DEBUG * JSON => "json"
22:42:24.286 DEBUG * Text => "text"
22:42:24.287 DEBUG * Secrets => "secrets"
22:42:24.287 INFO Indexing files...
22:42:24.287 INFO Project configuration:
22:42:24.294 DEBUG 'sensitive.properties' indexed with no language
22:42:24.297 DEBUG 'test.ini' indexed with no language
22:42:24.297 DEBUG '1.pem' indexed with no language
22:42:24.297 DEBUG 'README.md' indexed with no language
22:42:24.298 DEBUG '2.pem' indexed with no language
22:42:24.298 DEBUG 'config.ini' indexed with no language
22:42:24.299 DEBUG 'sonar-project.properties' indexed with no language
22:42:24.300 DEBUG 'sonar-project.ini' indexed with no language
22:42:24.301 DEBUG 'app.py' indexed with language 'py'
22:42:24.302 DEBUG 'sensitive.py' indexed with language 'py'
22:42:24.302 DEBUG 'sonar-project-2.properties' indexed with no language
22:42:24.303 DEBUG 'awssecret/config.ini' indexed with no language
22:42:24.304 INFO 12 files indexed
22:42:24.305 INFO Quality profile for py: Sonar way
22:42:24.948 INFO Sensor Python Sensor [python]
22:42:24.952 WARN Your code is analyzed as compatible with all Python 3 versions by default. You can get a more precise analysis by setting the exact Python version in your configuration via the parameter "sonar.python.version"
22:42:24.969 DEBUG Input files for indexing: [app.py, sensitive.py]
22:42:24.971 INFO Starting global symbols computation
22:42:24.972 INFO 2 source files to be analyzed
22:42:24.985 DEBUG 'app.py' generated metadata with charset 'UTF-8'
22:42:25.304 DEBUG 'sensitive.py' generated metadata with charset 'UTF-8'
22:42:25.340 INFO 2/2 source files have been analyzed
22:42:25.372 INFO Starting rules execution
22:42:25.372 INFO 2 source files to be analyzed
22:42:25.569 DEBUG Symbol _Never has conflicting fully qualified names:typing_extensions.Never,typing.Never
22:42:25.569 DEBUG It has been disambiguated with its latest Python version available symbol.
22:42:25.879 INFO 2/2 source files have been analyzed
22:42:25.879 INFO The Python analyzer was able to leverage cached data from previous analyses for 0 out of 2 files. These files were not parsed.
22:42:25.880 DEBUG Collected metric: PYTHON_VERSION_SET_KEY=0
22:42:25.880 DEBUG Collected metric: PYTHON_DATABRICKS_FOUND=0
22:42:26.435 INFO Using git CLI to retrieve untracked files
22:42:26.491 INFO Analyzing language associated files and files included via "sonar.text.inclusions" that are tracked by git
22:42:26.494 DEBUG '1.pem' generated metadata with charset 'UTF-8'
22:42:26.495 DEBUG 'sonar-project.properties' generated metadata with charset 'UTF-8'
22:42:26.495 DEBUG 'config.ini' generated metadata with charset 'UTF-8'
22:42:26.496 DEBUG 'sensitive.properties' generated metadata with charset 'UTF-8'
22:42:26.497 DEBUG 'awssecret/config.ini' generated metadata with charset 'UTF-8'
22:42:26.498 DEBUG '2.pem' generated metadata with charset 'UTF-8'
22:42:26.499 DEBUG 'test.ini' generated metadata with charset 'UTF-8'
22:42:26.500 DEBUG 'sonar-project.ini' generated metadata with charset 'UTF-8'
22:42:26.500 DEBUG 'sonar-project-2.properties' generated metadata with charset 'UTF-8'
22:42:26.512 INFO 11 source files to be analyzed
22:42:26.540 INFO 11/11 source files have been analyzed
22:42:26.541 INFO Sensor TextAndSecretsSensor [text] (done) | time=557ms
This is an open community with people volunteering their free time to provide assistance. Weâre eager to contribute to the community, but you are not guaranteed a fast response.
As far as the scanner logs go, everything looks correct.
What I doubt is correct is the secret youâre trying to pick up. The scanner will only detect real secrets, and do its best to filter out false-positives. Your key starts with abcd, which is filtered out by the rule.
I suggest you try the example in the rule description, kHeUAwnSUizTWpSbyGAz4f+As5LshPIjvtpswqGb.
Blockquote
In SonarQube Community Edition 25.3.0, secret detection is limited and does not work effectively for non-code files like .env, .txt, or configuration files. The Community Edition primarily focuses on code analysis and lacks built-in secret scanning for non-code content. To detect secrets in such files, users must rely on external tools like Gitleaks or TruffleHog. The Enterprise Edition of SonarQube includes advanced secret detection capabilities. For comprehensive scanning, integrating third-party security tools alongside SonarQube is recommended.
what bothers me is why âquality profileâ for secrets is shown as never used . means its not getting picked up. although in scanner context it does say files which are included and same files are reflected in logs as well.
something is not good with secret detection feature in sonarqube CE
00:51:53.992 INFO Using git CLI to retrieve untracked files
00:51:54.033 INFO Analyzing language associated files and files included via "sonar.text.inclusions" that are tracked by git
00:51:54.036 DEBUG '1.pem' generated metadata with charset 'UTF-8'
00:51:54.038 DEBUG 'sonar-project.properties' generated metadata with charset 'UTF-8'
00:51:54.038 DEBUG 'config.ini' generated metadata with charset 'UTF-8'
00:51:54.039 DEBUG 'sensitive.properties' generated metadata with charset 'UTF-8'
00:51:54.040 DEBUG 'awssecret/config.ini' generated metadata with charset 'UTF-8'
00:51:54.040 DEBUG '2.pem' generated metadata with charset 'UTF-8'
00:51:54.041 DEBUG 'test.ini' generated metadata with charset 'UTF-8'
00:51:54.042 DEBUG 'sonar-project.ini' generated metadata with charset 'UTF-8'
00:51:54.043 DEBUG 'sonar-project-2.properties' generated metadata with charset 'UTF-8'
00:51:54.054 INFO 11 source files to be analyzed
00:51:54.082 INFO 11/11 source files have been analyzed
00:51:54.083 INFO Sensor TextAndSecretsSensor [text] (done) | time=470ms
- sonar.text.inclusions=/Users/abcde/Downloads/abcd_poc/test-python/test-sonar/test.ini,config.ini,test.ini,**/*.py,**/*.ini,**/*.properties,**/*.pem
- sonar.token=******