Add a Snyk Integration
- In the OpsLevel app, Click Integrations in the left sidebar.
- Click on the + New Integration button.
- Click the Snyk tile to add the integration.
Create a Check
1. Navigate to the Rubrics sub menu under the Service Health menu in OpsLevel
2. Hover over the cell that corresponds to the level and category you want your check to live in and click the + Add Check button.
3. Create a Custom Event check
4. Select the Snyk integration you created from the Integration dropdown
5. Choose one of the Check Templates from the dropdown.
Here is what each template is for:
- No Critical Vulnerabilities: Any service that has critical vulnerabilities in its package manifest file will fail this check.
- No High Vulnerabilities: Any service that has high vulnerabilities in its package manifest file will fail this check.
- Less than 3 Medium Vulnerabilities: Any service with 3 or more medium vulnerabilities in its package manifest file will fail this check.
- Less than 5 Low Vulnerabilities: Any service with 5 or more low vulnerabilities in its package manifest file will fail this check.
6. We will populate the Service Specifier field, which we use to determine what service to run the check for, and the Success Condition field, which we use to determine if the check should pass or fail. We also provide a sample payload to test the check.
Send payload to OpsLevel
snyk test --prune-repeated-subdependencies --json | curl -X POST https://app.opslevel.com/integrations/custom_event/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \ -H 'content-type: application/json' --data-binary @-
This will send all the vulnerabilities for the service to OpsLevel and we will execute the check that was created in the previous step. You will need to substitute the endpoint URL from the Snyk Integration you created in place of xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
To learn more about the Snyk CLI, you can read their docs.