Skip to content

reimport: optimize vulnerability_id processing#13891

Closed
valentijnscholten wants to merge 4 commits intoDefectDojo:bugfixfrom
valentijnscholten:reimport-vuln-id-optimize
Closed

reimport: optimize vulnerability_id processing#13891
valentijnscholten wants to merge 4 commits intoDefectDojo:bugfixfrom
valentijnscholten:reimport-vuln-id-optimize

Conversation

@valentijnscholten
Copy link
Member

@valentijnscholten valentijnscholten commented Dec 13, 2025

Reimport was overwriting vulnerability_ids for every finding in the report. Since this is a OneToMany field this is expensive.
This PR prefetches the existing vulnerability_ids and only updates them if the report being reimported has different vulnerability_ids for this finding. Also it gets rid of the duplicate delete query for existing findings.

on a reimport of the 13k jfrog sample report this saves almost 50% of time (117s -> 63s)

Successfully reimported 'jfrog_xray_unified/very_many_vulns.json' into test ID 1008 (took 116.76 seconds)
Successfully reimported 'jfrog_xray_unified/very_many_vulns.json' into test ID 1008 (took 62.76 seconds)

The pr also fixes a bug where a change in finding.cve was not persisted.
Also added some test cases.

@valentijnscholten valentijnscholten added this to the 2.53.2 milestone Dec 13, 2025
@valentijnscholten
Copy link
Member Author

It's too time consuming to implement this separate from the batch reimport pr, so I'm closing this.
Changes are included in #13889

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant