Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Integration][Snyk] - Migrate API from v1 to REST (#828)
# Description What - Snyk has announced that they will burn down their v1 API by end of Q3, and all subsequent calls to their v1 APIs will return 410 (gone). This PR migrates all instances of our Snyk exporter that relies on the v1 API, and moves them to the REST API. The PR contains the following: 1. Migration of v1 API to REST API 2. Added additional kind called `vulnerabilities`. and this will be used to ingest Snyk vulnerabilities for new customers. To support backwards compatibility, the existing `issue` kind is maintained, and will be switched for the vulnerabilities after Q3 when we have communicated the deprecation notice to client 3. Moved calculation of low|medium|high|critical open vulnerabilities on the Target blueprint to Aggregation property to reduce making calls to Snyk. 4. Other blueprint and mapping changes Why - How - Get issues, get organizations, get users etc are now using REST API ## Type of change Please leave one option from the following and delete the rest: - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] New Integration (non-breaking change which adds a new integration) - [x] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Non-breaking change (fix of existing functionality that will not change current behavior) - [ ] Documentation (added/updated documentation) ## Screenshots Include screenshots from your environment showing how the resources of the integration will look. ## API Documentation [Issues API](https://apidocs.snyk.io/?version=2024-06-21#get-/orgs/-org_id-/issues) [Users API](https://apidocs.snyk.io/?version=2024-06-21%7Ebeta#get-/orgs/-org_id-/users/-id-) ## API SAMPLE RESPONSE Issues from REST API ```json { "id": "0ecc9091-c1cc-4107-a6cb-d66bb7935ede", "type": "issue", "attributes": { "classes": [ { "id": "CWE-94", "source": "CWE", "type": "weakness" } ], "coordinates": [ { "representations": [ { "dependency": { "package_name": "vm2", "package_version": "3.9.19" } } ] } ], "created_at": "2023-09-03T15:02:41.211Z", "effective_severity_level": "critical", "ignored": false, "key": "SNYK-JS-VM2-5772825", "problems": [ { "id": "CVE-2023-37466", "source": "SNYK", "type": "vulnerability", "updated_at": "2024-01-12T07:35:26.623212Z" }, { "id": "SNYK-JS-VM2-5772825", "source": "SNYK", "type": "vulnerability", "updated_at": "2024-01-12T07:35:26.623212Z" } ], "risk": { "factors": [], "score": { "model": "v1", "value": 597 } }, "status": "open", "title": "Remote Code Execution (RCE)", "type": "package_vulnerability", "updated_at": "2023-09-03T15:02:41.211Z" }, "relationships": { "organization": { "data": { "id": "7c5908e4d4d2", "type": "organization" }, "links": { "related": "/orgs/7c5908e4d4d2" } }, "scan_item": { "data": { "id": "36f9fbb0-caf2-48a7-bbac-e7c1dc093f37", "type": "project" }, "links": { "related": "/orgs/7c5908e4d4d2/projects/36f9fbb0-caf2-48a7-bbac-e7c1dc093f37" } } } } ``` Organizations from REST API ```json { "id": "7c5908e4d4d2", "type": "org", "attributes": { "group_id": "49270cfc54b5", "is_personal": false, "name": "Port NFR - Shared", "slug": "port-nfr-shared" }, "relationships": { "member_role": { "data": { "id": "9409d7b4f883", "type": "org_role" } } } } ```
- Loading branch information