django-DefectDojo icon indicating copy to clipboard operation
django-DefectDojo copied to clipboard

Sonarqube API import not working

Open enidevops opened this issue 2 years ago • 2 comments

Bug description Having last used the Sonarqube API Import over a year ago, we now need it again for a project. Previously, we used the following command to import results from Sonarqube API into DefectDojo:

curl --location --request POST https://defectdojo.internal/api/v2/import-scan/ \
        --header "Authorization: Token 123456789" \
        --form "engagement=434" \
        --form 'verified="true"' \
        --form 'active="true"' \
        --form "scan_date=2024-03-13" \
        --form 'scan_type="SonarQube API Import"' \
        --form 'minimum_severity="Info"' \
        --form 'skip_duplicates="true"' \
        --form 'close_old_findings="true"' \
        --form "environment=GITLAB" \
        --form "api_scan_configuration=136" \
        --form "branch_tag=sonarqube-integration" \
        --form "tags=sonarqube-integration" \
        --form 'apply_tags_to_findings="true"'

Running this command on DefectDojo version 2.32.1 yields the following result, indicating that no vulnerabilities were imported:

{"scan_date":"2024-03-13","minimum_severity":"Info","active":true,"verified":true,"scan_type":"SonarQube API Import","endpoint_to_add":null,"engagement":434,"auto_create_context":false,"deduplication_on_engagement":false,"lead":null,"tags":["sonarqube-integration"],"close_old_findings":true,"close_old_findings_product_scope":false,"push_to_jira":false,"environment":"GITLAB","branch_tag":"sonarqube-integration","api_scan_configuration":136,"create_finding_groups_for_all_findings":true,"test":33126,"test_id":33126,"engagement_id":434,"product_id":71,"product_type_id":40,"statistics":{"after":{"info":{"active":0,"verified":0,"duplicate":0,"false_p":0,"out_of_scope":0,"is_mitigated":0,"risk_accepted":0,"total":0},"low":{"active":0,"verified":0,"duplicate":0,"false_p":0,"out_of_scope":0,"is_mitigated":0,"risk_accepted":0,"total":0},"medium":{"active":0,"verified":0,"duplicate":0,"false_p":0,"out_of_scope":0,"is_mitigated":0,"risk_accepted":0,"total":0},"high":{"active":0,"verified":0,"duplicate":0,"false_p":0,"out_of_scope":0,"is_mitigated":0,"risk_accepted":0,"total":0},"critical":{"active":0,"verified":0,"duplicate":0,"false_p":0,"out_of_scope":0,"is_mitigated":0,"risk_accepted":0,"total":0},"total":{"active":0,"verified":0,"duplicate":0,"false_p":0,"out_of_scope":0,"is_mitigated":0,"risk_accepted":0,"total":0}}},"apply_tags_to_findings":true}

and the import in DefectDojo is empty as well:

sonar

But in the Sonarqube UI I can see the following findings:

image

The expected behavior is for the six bugs and four vulnerabilities to be imported into DefectDojo.

My Scan configuration:

image

Deployment method

  • [ ] Docker Compose
  • [X ] Kubernetes
  • [ ] GoDojo

Environment information

  • DefectDojo version 2.32.1
  • Sonarqube Developer EditionVersion 10.4.1

enidevops avatar Mar 14 '24 09:03 enidevops

Can you try again with the latest Defect Dojo and share the logs of the uwsgi container?

valentijnscholten avatar Oct 05 '25 09:10 valentijnscholten

Hi @valentijnscholten - this works now, thx!

enidevops avatar Oct 24 '25 13:10 enidevops