telekom-mms / trivy-dojo-report-operator

This Kubernetes operator listens for vulnerability reports generated by the Trivy Operator and forwards them to Defect Dojo for further analysis and tracking.
GNU General Public License v3.0
13 stars 15 forks source link

[Bug] Duplicated Engagements #71

Open afagund opened 4 months ago

afagund commented 4 months ago

Description

We have defectDojoEngagementName set to meta['namespace']". There are times where engagement names get duplicated instead of getting re-used. Is there a way to avoid these duplicates? Is this some sort of race condition?

image

Reproduction steps

  1. Set defectDojoEngagementName to meta['namespace']"
  2. Delete all reports from a namespace with several VulnerabilityReports
  3. Check if there are engagements with same name on DefectDojo

Current Behavior

We see 2 or more engagements with the same name.

Expected Behavior

No more than one engagement with a specific name.

Additional information

No response

qsoul commented 1 month ago

Faced the same behavior. I believe it happens at the moment of the initial export - when there are multiple tests for the same defectDojoEngagementName to export but there is no context (product_type/product/engagement) created yet. At that moment it pushes the first test. Then pushes the second one, but still there is no engagement with such a name created yet, so it creates a duplicate name. All the following test (and re-imports) are pushed to a single same engagement in my case.