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

apply_tags_to_findings not working as intended

Open enidevops opened this issue 2 years ago • 7 comments

Bug description It appears there's an issue with the apply_tags_to_findings API functionality. During the process of importing results with the following command:

curl --location --request POST 'https://defectdojo.internal/api/v2/import-scan/'
--header 'Authorization: Token 123456'
--form 'engagement=434'
--form 'verified="true"'
--form 'active="true"'
--form 'scan_date=2024-03-13'
--form 'scan_type=MobSF Scan'
--form 'minimum_severity="Info"'
--form 'skip_duplicates="true"'
--form 'close_old_findings="false"'
--form 'environment=GITLAB'
--form 'apply_tags_to_findings="true"'
--form 'tags="test1"'
--form 'file=@mobsf_scan.json;type=application/json'

I get the following result:

image The tag gets applied correctly to the test itself, but the findings tags are messed up:

image

**Sample File mobsf_scan.txt

Deployment method (select with an X)

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

Environment information

  • DefectDojo version 2.32.2

enidevops avatar Mar 28 '24 08:03 enidevops

@enidevops There's a couple of PRs that were merged after 2.32.2 that involve tags - I'd look a those and potentially upgrade. See https://github.com/DefectDojo/django-DefectDojo/releases/tag/2.32.3

There have been a couple of tag-related PRs against the dev branch which will be part of the 2.33.0 release next week (assuming the are approved and merged). So there's a decent chance 2.33.0 will resolve this as well.

mtesauro avatar Mar 28 '24 22:03 mtesauro

@enidevops Just checked and this isn't happening with #9830 which will be in 2.33.0 (Monday, April 1st)

mtesauro avatar Mar 29 '24 01:03 mtesauro

@mtesauro ok great, thank you! then I will wait for the 2.33.0 release

enidevops avatar Mar 29 '24 06:03 enidevops

@enidevops Feel free to reopen this if needed but I don't expect it to be needed so I'm closing this now.

mtesauro avatar Mar 29 '24 14:03 mtesauro

@mtesauro I just tried the same command with 2.33.0 and now the tags are only applied to the test and not the findings:

image

enidevops avatar Apr 03 '24 11:04 enidevops

This seems to be happening only with the scan type 'MobSF Scan'. I tested this with the SARIF format and there it is working

enidevops avatar Apr 03 '24 12:04 enidevops

@enidevops Perhaps compare the structure of your MobSF Scan file output to what's in the unit tests because I'm not seeing that behavior with those files.

mtesauro avatar Apr 04 '24 21:04 mtesauro