This python script will download your SonarQube vulnerability SAST report as a json file. This script works for both Sonarcloud (SaaS) and SonarQube (on-premise).
- You must have Python installed in your environment. If you don't have Python installed, please do so by visiting the Python download site here.
- You will need to run the script via your terminal or command prompt.
Example values: https://sonarcloud.io
or http://localhost:9000
Generate this token at by following the instruction here
Your Sonarcloud Org ID. If you are using SonarQube, enter none
Your Sonarqube project key
The branch name.
For example: main
Name of the output report
For example: sonar_report.json
SONARQUBE_HOST_URL=https://sonarcloud.io \
SONARQUBE_TOKEN=XXX \
SONARQUBE_ORG=antonychiu2 \
SONARQUBE_PROJECT=antonychiu2_wf-examples-sonar \
BRANCH=main \
REPORT_PATH=sonar_report.json \
python sonarqube_download_report.py
SONARQUBE_HOST_URL=https://sonarcloud.io \
SONARQUBE_TOKEN=XXX \
SONARQUBE_ORG=antonychiu2 \
SONARQUBE_PROJECT=antonychiu2_wf-examples-sonar \
PULL_REQUEST_ID=13 \
REPORT_PATH=sonar_report.json \
python sonarqube_download_report.py
SONARQUBE_HOST_URL=http://local-ubuntu-vm:9000 \
SONARQUBE_TOKEN=XXX \
SONARQUBE_ORG=none \
SONARQUBE_PROJECT=webgoat-local \
BRANCH=main \
REPORT_PATH=sonar_report.json \
python sonarqube_download_report.py