githubEdit

CLI commands and options summary

circle-info

This page only summarizes the CLI commands and the options for each command. For details, use the links in this summary to open the help docs page for the command you are using. The help docs pages are the same as the help in the CLI.

Usage

snyk [COMMAND] [SUBCOMMAND] [OPTIONS] [PACKAGE] [CONTEXT-SPECIFIC-OPTIONS]

Description

The Snyk CLI is a build-time tool to find and fix known vulnerabilities in your projects. For a more detailed description of Snyk CLI and Snyk, see Snyk CLIarrow-up-right. For an introduction on how to use the Snyk CLI, see Getting started with the CLIarrow-up-right.

Available CLI commands

To learn more about each Snyk CLI command, use the --help option, for example, snyk auth --help or snyk container --help. Each command in this list is linked to the corresponding help page in these docs.

Note: Lists of all the options for Snyk CLI commands are on this page. The options are explained in detail in the help for each command.

Authenticate Snyk CLI with a Snyk account.

Test a project for open source vulnerabilities and license issues.

Snapshot and continuously monitor a project for open source vulnerabilities and license issues.

Print a list of the snyk container commands, snyk container monitor and snyk container test.

Capture the container image layers and dependencies and monitor for vulnerabilities on snyk.ioarrow-up-right

Test container images for any known vulnerabilities.

Print a list of the snyk iac commands: snyk iac describe, snyk iac update-exclude-policy, and snyk iac test.

Generate a mapping artifact that contains the minimum amount of information needed to generate, from Terraform state files, resource mappings from code to Cloud, such as resource IDs and names, and send the mapping artifact to Snyk.

Detect, track, and alert on infrastructure drift and unmanaged resources.

Generate exclude policy rules to be used by snyk iac describe.

Test for any known security issue.

Print the name of the snyk code command with its help option: snyk code test

Test for any known security issues using Static Code Analysis.

Find Log4Shell vulnerability.

Manage Snyk CLI configuration.

generates a mapping artifact that contains the minimum amount of information needed to generate, from Terraform state files, resource mappings from code to Cloud, such as resource IDs and names, and sends the mapping artifact to Snyk.Display the .snyk policy for a package.

Modify the .snyk policy to ignore stated issues.

Generate an SBOM for a local software project in an ecosystem supported by Snyk.

New CLI commands

Apply the recommended updates for supported ecosystems automatically.

Create a Snyk App using the Snyk CLI.

Subcommands of CLI commands

The following is a list of the sub-commands for Snyk CLI commands. Each sub-command is followed by the command(s) to which the sub-command applies. The commands are linked to their help docs. For details concerning each sub-command, see the help docs.

get <KEY>: subcommand of configarrow-up-right

set <KEY>=<VALUE>: subcommand of configarrow-up-right

unset <KEY>: subcommand of configarrow-up-right

clear: subcommand of configarrow-up-right

Configure the Snyk CLI

You can use environment variables to configure the Snyk CLI and also set variables to configure the Snyk CLI to connect with the Snyk API. See Configure the Snyk CLIarrow-up-right.

Debug

Use -d option to output the debug logs for any command.

Exit codes for CLI commands

Exit codes for the test commands are all the same. See the exit codes in the following help docs:

Additional CLI commands have exit codes as listed in the following help docs:

Options for multiple commands

Lists of the options for Snyk CLI commands follow. Each option is followed by the command(s) to which the option applies. The commands are linked to their help docs. For details concerning each option, see the help docsarrow-up-right.

--all-projects: testarrow-up-right, monitorarrow-up-right

--fail-fast: testarrow-up-right, monitorarrow-up-right

--detection-depth=<DEPTH>: testarrow-up-right, monitorarrow-up-right, iac testarrow-up-right

--exclude=<NAME>[,<NAME>]...>: testarrow-up-right, monitorarrow-up-right

--prune-repeated-subdependencies, -p: testarrow-up-right, monitorarrow-up-right

--print-deps: testarrow-up-right, monitorarrow-up-right, container testarrow-up-right

--remote-repo-url=<URL>: testarrow-up-right, monitorarrow-up-right, iac testarrow-up-right

--dev: testarrow-up-right, monitorarrow-up-right

--org=<ORG_ID>: testarrow-up-right, monitorarrow-up-right, code testarrow-up-right, container testarrow-up-right, container monitorarrow-up-right, iac testarrow-up-right, iac describearrow-up-right, iac capturearrow-up-right, sbomarrow-up-right

--file=<FILE>: testarrow-up-right, monitorarrow-up-right

--package-manager=<PACKAGE_MANAGER_NAME>: testarrow-up-right, monitorarrow-up-right

--unmanaged: test, monitor. See also Options for scanning using --unmanagedarrow-up-right and the sbomarrow-up-right command help for another use of this option.

--ignore-policy: testarrow-up-right, monitorarrow-up-right, iac testarrow-up-right, iac describearrow-up-right

--trust-policies testarrow-up-right, monitorarrow-up-right

--show-vulnerable-paths=<none|some|all> testarrow-up-right

--project-name=<PROJECT_NAME>: testarrow-up-right, monitorarrow-up-right, container testarrow-up-right, container monitorarrow-up-right

--target-reference=<TARGET_REFERENCE>: testarrow-up-right, monitorarrow-up-right, iac testarrow-up-right

--policy-path=<PATH_TO_POLICY_FILE>: testarrow-up-right, monitorarrow-up-right, container testarrow-up-right, container monitorarrow-up-right, iac testarrow-up-right, iac describearrow-up-right, ignorearrow-up-right

--json: testarrow-up-right, monitorarrow-up-right, code testarrow-up-right, container testarrow-up-right, container monitorarrow-up-right, iac testarrow-up-right, iac describearrow-up-right

--json-file-output=<OUTPUT_FILE_PATH>: test, code testarrow-up-right, container testarrow-up-right, iac testarrow-up-right

--sarif: testarrow-up-right, code testarrow-up-right, container testarrow-up-right, iac testarrow-up-right

--sarif-file-output=<OUTPUT_FILE_PATH>: testarrow-up-right, code testarrow-up-right, container testarrow-up-right, iac testarrow-up-right

--severity-threshold=<low|medium|high|critical>: testarrow-up-right, code testarrow-up-right, container testarrow-up-right, iac testarrow-up-right

--fail-on=<all|upgradable|patchable>: container testarrow-up-right, testarrow-up-right

--project-environment=<ENVIRONMENT>[,<ENVIRONMENT>]...>: monitorarrow-up-right, container monitorarrow-up-right, iac testarrow-up-right

--project-lifecycle=<LIFECYCLE>[,<LIFECYCLE>]...>: monitorarrow-up-right, container monitorarrow-up-right, iac testarrow-up-right

--project-business-criticality=<BUSINESS_CRITICALITY>[,<BUSINESS_CRITICALITY>]...>: monitorarrow-up-right, container monitorarrow-up-right, iac testarrow-up-right

--project-tags=<TAG>[,<TAG>]...>: monitorarrow-up-right, container monitorarrow-up-right, iac testarrow-up-right

--tags=<TAG>[,<TAG>]...>: monitorarrow-up-right, container monitorarrow-up-right

snyk code test and snyk iac test command option

--report: code testarrow-up-right, iac testarrow-up-right

snyk container command options

--file=<FILE_PATH>: container testarrow-up-right, container monitorarrow-up-right

--app-vulns: container testarrow-up-right, containermonitorarrow-up-right

--exclude-app-vulns: container testarrow-up-right, container monitorarrow-up-right

--nested-jars-depth: container testarrow-up-right, container monitorarrow-up-right

--exclude-base-image-vulns: container testarrow-up-right, container monitorarrow-up-right

--platform=<PLATFORM>: container testarrow-up-right, container monitorarrow-up-right

--username=<CONTAINER_REGISTRY_USERNAME>: container testarrow-up-right, container monitorarrow-up-right

--password=<CONTAINER_REGISTRY_PASSWORD>: container testarrow-up-right, container monitorarrow-up-right

snyk iac test command options

--scan=<TERRAFORM_PLAN_SCAN_MODE>: iac testarrow-up-right

--target-name=<TARGET_NAME>: iac testarrow-up-right

--rules=<PATH_TO_CUSTOM_RULES_BUNDLE>: iac testarrow-up-right

--var-file=<PATH_TO_VARIABLE_FILE>: iac testarrow-up-right

snyk iac capture command options

--stdin: iac capturearrow-up-right

PATH: iac capturearrow-up-right

snyk iac describe command options

--from=<STATE>[,<STATE>...]: iac describearrow-up-right

--to=<PROVIDER+TYPE>: iac describearrow-up-right

--service=<SERVICE>[,<SERVICE]...>: iac describearrow-up-right

--all: iac describearrow-up-right

--only-managed or --drift: iac describearrow-up-right

--only-unmanaged: iac describearrow-up-right

--quiet: iac describearrow-up-right

--filter: iac describearrow-up-right

--html: iac describearrow-up-right

--html-file-output=<OUTPUTFILEPATH>: iac-describearrow-up-right

--fetch-tfstate-headers: iac describearrow-up-right

--tfc-token: iac describearrow-up-right

--tfc-endpoint: iac describearrow-up-right

--tf-provider-version: iac describearrow-up-right

--strict: iac describearrow-up-right

--deep: iac describearrow-up-right

--tf-lockfile: iac describearrow-up-right

--config-dir: iac describearrow-up-right

snyk iac update-exclude-policy command options

--exclude-changed: iac update-exclude-policyarrow-up-right

--exclude-missing: iac update-exclude-policyarrow-up-right

--exclude-unmanaged: iac update-exclude-policyarrow-up-right

snyk ignore command options

--id=<ISSUE_ID>: ignorearrow-up-right

--expiry=<EXPIRY>: ignorearrow-up-right

--reason=<REASON>: ignorearrow-up-right

--path=<PATH_TO_RESOURCE>: ignorearrow-up-right

snyk sbom command options

--format=<cyclonedx1.4+json|cyclonedx1.4+xml|spdx2.3+json>: snyk sbomarrow-up-right

[--file=] or [--f=]: snyk sbomarrow-up-right

[<TARGET_DIRECTORY>]: snyk sbomarrow-up-right

Option for Maven projects

--scan-all-unmanaged: testarrow-up-right, monitorarrow-up-right

Options for Gradle projects

--sub-project=<NAME>, --gradle-sub-project=<NAME>: testarrow-up-right, monitorarrow-up-right

--all-sub-projects: testarrow-up-right, monitorarrow-up-right

--configuration-matching=<CONFIGURATION_REGEX>: testarrow-up-right, monitorarrow-up-right

--configuration-attributes=<ATTRIBUTE>[,<ATTRIBUTE>]...: testarrow-up-right, monitorarrow-up-right

--init-script=<FILE: testarrow-up-right, monitorarrow-up-right

Options for .Net and NuGet projects

--file=.sln: testarrow-up-right

--file=packages.config: testarrow-up-right

--assets-project-name: testarrow-up-right, monitorarrow-up-right

--packages-folder: testarrow-up-right, monitorarrow-up-right

--project-name-prefix=<PREFIX_STRING>: testarrow-up-right, monitorarrow-up-right

--project-name-prefix=my-group/: testarrow-up-right, monitorarrow-up-right

Options for npm projects

--strict-out-of-sync=true|false: testarrow-up-right, monitorarrow-up-right

Options for Yarn projects

--strict-out-of-sync=true|false: testarrow-up-right, monitorarrow-up-right

--yarn-workspaces: testarrow-up-right, monitorarrow-up-right

Options for CocoaPods projects

--strict-out-of-sync=true|false: testarrow-up-right, monitorarrow-up-right

Options for Python projects

--command=<COMMAND>: testarrow-up-right, monitorarrow-up-right

--skip-unresolved=true|false: testarrow-up-right, monitorarrow-up-right

Options for Go projects

Currently the following options are not supported:

--fail-on=<all|upgradable|patchable>: testarrow-up-right

Options for scanning using --unmanaged

--org=<ORG_ID>: test, monitorarrow-up-right

--json: test, monitorarrow-up-right

--json-file-output=<OUTPUT_FILE_PATH>: test

--remote-repo-url=<URL>: test

--severity-threshold=<low|medium|high|critical>: test

--target-reference=<TARGET_REFERENCE>: test, monitor

--max-depth: test, monitorarrow-up-right

--print-dep-paths: test, monitorarrow-up-right

--project-name=c-project: monitorarrow-up-right

-- [<CONTEXT-SPECIFIC_OPTIONS>]

These options are used with the snyk test and snyk monitor commands. See the help docs for snyk testarrow-up-right and snyk monitorarrow-up-right for details.

Last updated

Was this helpful?