Snyk scans and monitors your projects for security vulnerabilities.
Snyk is a developer-first cloud-native security tool. It covers multiple areas of application security:
Snyk CLI brings the functionality of Snyk into your development workflow. It can be run locally or in your CI/CD pipeline to scan your projects for security issues.
CLI also supports Docker scanning and Terraform, k8s and other Infrastructure as Code files scanning.
Snyk CLI can be installed through multiple channels.
Snyk CLI is available as an npm package. If you have Node.js installed locally, you can install it by running:
npm install snyk@latest -g
or if you are using Yarn:
yarn global add snyk
Use GitHub Releases to download a standalone executable of Snyk CLI for your platform.
We also provide these standalone executables on our official CDN. See the
release.json file for the download links:
https://static.snyk.io/cli/latest/release.json # Or for specific version or platform https://static.snyk.io/cli/v1.666.0/release.json https://static.snyk.io/cli/latest/snyk-macos
For example, to download and run the latest Snyk CLI on macOS, you could run:
curl https://static.snyk.io/cli/latest/snyk-macos -o snyk chmod +x ./snyk mv ./snyk /usr/local/bin/
You can also use these direct links to download the executables:
Drawback of this method is, that you will have to manually keep the Snyk CLI up to date.
brew tap snyk/tap brew install snyk
scoop bucket add snyk https://github.com/snyk/scoop-snyk scoop install snyk
These images wrap the Snyk CLI and depending on the Tag come with a relevant tooling for different projects. For example scanning a Gradle project with snyk/snyk-cli:
docker run -it -e "SNYK_TOKEN=<TOKEN>" -e "USER_ID=1234" -v "<PROJECT_DIRECTORY>:/project" -v "/home/user/.gradle:/home/node/.gradle" snyk/snyk-cli:gradle-5.4 test --org=my-org-name
Snyk also offers many integrations into developer tooling. These integrations will install and manage the Snyk CLI for you. For example:
Once you installed the Snyk CLI, you can verify it's working by running
If you are already in a folder with a supported project, start by running:
Or scan a Docker image by its tag with Snyk Container:
snyk container test ubuntu:18.04
Or a k8s file:
snyk iac test /path/to/kubernetes_file.yaml
Snyk can also monitor your project periodically and alert you for new vulnerabilities. The
snyk monitor is similar to
snyk test and can be used to create a project on the Snyk website that will be continuously monitored for new vulnerabilities.
> snyk monitor Monitoring /project (project-name)... Explore this snapshot at https://app.snyk.io/org/my-org/project/29361c2c-9005-4692-8df4-88f1c040fa7c/history/e1c994b3-de5d-482b-9281-eab4236c851e Notifications about newly disclosed issues related to these dependencies will be emailed to you.
Snyk is really powerful when you are continuously scanning and monitoring your projects for vulnerabilities.
Use one of our integrations to stay secure.
You can authorize Snyk CLI in your CI/CD programatically:
# Using a SNYK_TOKEN envvar (preferred) SNYK_TOKEN=<SNYK_API_TOKEN> snyk test # Or using a Snyk auth command snyk auth <SNYK_API_TOKEN> snyk test
Here are some flags that you might find useful:
Only report vulnerabilities of provided level or higher.
Prints results in JSON format.
Auto-detect all projects in working directory
See all the available commands and options by running
snyk --help # or get help for a specific command like snyk iac --help snyk code --help
We recommend reaching out via the firstname.lastname@example.org email whenever you need help with Snyk CLI or Snyk in general.
GitHub Issues on any Snyk project are not actively monitored by Snyk support.
This project is open source but we don't encourage outside contributors.
This repository is a monorepo, also covering other projects and tools:
For any security issues or concerns, please see SECURITY.md file in this repository.
Made with 💜 by Snyk