Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplications in results cache #129

Merged
merged 6 commits into from
Aug 10, 2023

Conversation

asafgabai
Copy link
Contributor

@asafgabai asafgabai commented Aug 2, 2023

  • All tests passed. If this feature is not already covered by the tests, I added new tests.

Fix duplications of VulnerabilityNodes in the cache, that caused errors while trying to read it.
Usually, a VulnerabilityNode is written to the cache file once: as a child of a DescriptorFileTreeNode.
If there's an ApplicableIssueNode pointing to it, then this ApplicableIssueNode contains a field with the VulnerabilityNode's UUID.
But sometimes, if the ApplicableIssueNode pointing to this VulnerabilityNode has been written before the VulnerabilityNode, then the VulnerabilityNode is written inside the ApplicableIssueNode (instead of just its UUID), and later when the DescriptorFileTreeNode (that contains this VulnerabilityNode) is written, then the VulnerabilityNode is written again.
Both times the VulnerabilityNode is written with the same UUID (because it's the same object), so when the cache is read, a parsing error is thrown, saying there are multiple objects with the same UUID.
To fix that, I added an annotation that enforces writing the VulnerabilityNode, that's inside the ApplicableIssueNode, as a UUID only.

@asafgabai asafgabai added the bug Something isn't working label Aug 2, 2023
@asafgabai asafgabai marked this pull request as ready for review August 3, 2023 07:38
@asafgabai asafgabai requested a review from talarian1 August 3, 2023 07:39
@asafgabai asafgabai merged commit 38320da into jfrog:master Aug 10, 2023
@asafgabai asafgabai deleted the fix-duplications-in-cache branch August 10, 2023 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants