Add support for Snyk API version 2024-10-15 #4715
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses #4714 by adding support for the current version of the Snyk API.
Additional Details
Attempting to use version
2024-10-15
of the API results in the following error during analysis due to the response from/orgs/{org_id}/packages/{purl}/issues
having changed shape:In
2023-06-22
affected version ranges are reported underdata[].attributes.coordinates[].representation
as an array of strings, e.g.:In
2024-10-15
these same strings are now embedded in an array of objects under the property namerepresentations
:The proposed fix attempts to read both properties and selects different parsing behaviour depending on which one is present. As far as I can tell this is the only breaking change between the two API versions that is relevant to DT's Snyk integration. I've tested the fix against both
2023-06-22
and2024-10-15
successfully and updated the unit tests to cover the new format. Apologies if the implementation is lacking, I've not written any Java in a while.This PR does not alter the default Snyk API version used by DT.
Checklist
This PR fixes a defect, and I have provided tests to verify that the fix is effectiveThis PR introduces changes to the database model, and I have added corresponding update logic