SonarQube Token
ID |
sonarqube_token |
Severity |
low |
Vendor |
SonarQube |
Family |
API Token |
Description
SonarQube is an open-source platform developed by SonarSource for continuous inspection of code quality to perform automatic reviews with static analysis of code to detect bugs, code smells on 29 programming languages
SonarQube provides a web API to access its functionalities from application.
Security
Any hardcoded SonarQube Token is a potential secret reported by this detector.
Accidentally checking-in the token to source control repositories could compromise your SonarQube account.
Examples
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 ENV DOTNET_CLI_TELEMETRY_OPTOUT='true' ENV SONAR_TOKEN=599yxnmec858czgnyve4g6aqfkh5prunshpysepq WORKDIR /app RUN apt-get update && apt-get install -y openjdk-11-jdk RUN dotnet tool install --global dotnet-sonarscanner --version 5.6.0 ENV PATH="$PATH:/root/.dotnet/tools" RUN dotnet sonarscanner begin /k:"the_project" /d:sonar.host.url=https://sonarcloud.io /d:sonar.login="${SONAR_TOKEN}"
Mitigation / Fix
-
Remove the
Token
from the source code or committed configuration file. -
Follow your policy for handling leaked secrets, which typically require revoking the secret in the target system(s). API Key revocation can be handled from your Account Security Dashboard.
-
If under a git repository, you may remove unwanted files from the repository history using tools like
git filter-repo
orBFG Repo-Cleaner
. You may follow the procedure listed here for GitHub.
You should consider any sensitive data in commits with secrets as compromised. Remember that secrets may be removed from history in your projects, but not in other users' cloned or forked repositories. |