Snyk’s CLI helps you find and fix known vulnerabilities in your dependencies, both ad hoc and as part of your CI (Build) system.
The Snyk CLI requires you to authenticate with your account before using it. See our Language Support page for information about package managers and languages that the CLI supports.
The following sections cover:
Following is the complete list of commands available from the Snyk AppSec CLI tool.
auth [api-token].....Sign into Snyk.
test ............... Test for any known vulnerabilities.
wizard ............. Configure your policy file to update, auto patch and ignore vulnerabilities.
protect ............ Protect your code from vulnerabilities and optionally suppress specific vulnerabilities.
monitor ............ Record the state of dependencies and any vulnerabilities on snyk.io.
policy ............. Display the Snyk policy for a package.
ignore ............. Ignore an issue. For more help run `snyk help ignore`.
help [topic] ....... Display detailed help about commands and options.
config ............. Manage Snyk's configuration, note that this configuration is stored on your machine and applies to all Snyk CLI calls.
Following is a partial list of the options available to you when running commands from our CLI tool:
--all-projects runs an auto-discovery to scan the current directory and test all manifest files found. By default we scan the current directory and its immediate children.
This and related options are not available for Gradle and Maven. See Java for Snyk for similar functionality.
--detection-depth add this option if you want to increase the depth further than the default for --all-projects
--dev Include devDependencies.
--exclude=<comma separated list of directory names> enables you to run snyk test or
snyk monitor using the
--all-projects option while still excluding specified directories
--file Sets package file. For more help run `snyk help file`.
--org Associate a snapshot (or wizard snapshot) with a specific organization. For more help run `snyk help orgs`.
--ignore-policy Ignores and resets the state of your policy file.
--trust-policies Applies and uses ignore rules from your dependencies' Snyk policies, otherwise ignore policies are only shown as a suggestion.
--show-vulnerable-paths Display the dependency paths from the top level dependencies, down to the vulnerable packages (defaults to true). Applicable to `snyk test`.
--dry-run Don't apply updates or patches during protect.
--severity-threshold = low/medium/high; only report vulnerabilities of the provided level or higher.
-q, --quiet Silence all output.
-h, --help This help information.
-v, --version The CLI version.
$ snyk test
$ snyk test firstname.lastname@example.org
$ snyk monitor --org=my-team
$ snyk test --show-vulnerable-paths=false
snyk test in your test scripts. If a vulnerability is found, the process exits with a non-zero code.