dependency-track icon indicating copy to clipboard operation
dependency-track copied to clipboard

Database could avoid re-writing/updating vulnerability if value is not different

Open LaVibeX opened this issue 7 months ago • 5 comments

Current Behavior

Currently, the database re-writes all vulnerabilities that are given, without checking if the value has changed or not. This results in an expensive and unnecessary operation.

Proposed Behavior

To address this issue, we could consider adding a new column or reusing an existing column in the vulnerability table to store the last_modified value. This would allow us to compare the last_modified value of the existing vulnerability with the new vulnerability data.

Another option could be to process a checksum for the stored vulnerability data and compare it with the given value. This would allow us to determine if the vulnerability data has changed, without having to write non-updated values.

https://github.com/DependencyTrack/dependency-track/blob/26185e40335f4abe97a99280e6b02958f896611e/src/main/java/org/dependencytrack/persistence/VulnerabilityQueryManager.java#L145-L151

https://github.com/DependencyTrack/dependency-track/blob/26185e40335f4abe97a99280e6b02958f896611e/src/main/java/org/dependencytrack/persistence/VulnerabilityQueryManager.java#L90-L135

I have noticed that the CREATED and PUBLISHED values are often set to the same value. We could probably use published to save the "last modified" value. image

Checklist

LaVibeX avatar Jul 05 '24 10:07 LaVibeX