Snyk dotNET Action
This page provides examples of using the Snyk GitHub Action for dotNET. For instructions on using the action and further information see GitHub Actions integration.
Using the Snyk dotNET Action to check for vulnerabilities
You can use the Snyk dotNET Action to check for vulnerabilities as follows:
You can use the Snyk dotNET Action to check for only high severity vulnerabilities as follows:
It is required to restore the dependencies using dotnet restore
or nuget restore
before running the Snyk action
Using the Snyk dotNET Action to run snyk monitor
For an example of running snyk monitor
, see Snyk monitor example on the GitHub Actions integration page.
Uploading Snyk scan results to GitHub Code Scanning using the Snyk dotNET Action
Using --sarif-file-output
Snyk CLI option and the GitHub SARIF upload action, you can upload Snyk scan results to GitHub Code Scanning as shown in the example that follows.
The Snyk Action fails when vulnerabilities are found. This would prevent the SARIF upload action from running. Thus you must use a continue-on-error option as shown in this example:
To use the upload-sarif option for private repos you must have GitHub Advanced Security.
If you see the error Advanced Security must be enabled for this repository to use code scanning
, check that GitHub Advanced Security is enabled. For more information, see "Managing security and analysis settings for your repository."
Last updated