You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `snyk code test` command tests for any known security issues using Static Code Analysis.
10
+
11
+
For more information see [Using Snyk Code via the CLI](../../products/snyk-code/cli-for-snyk-code/).
12
+
13
+
For instructions on ignoring issues with `snyk code test` see [Excluding directories and files from the Snyk Code CLI test](../../products/snyk-code/cli-for-snyk-code/excluding-directories-and-files-from-the-snyk-code-cli-test.md).
14
+
15
+
## Exit codes
16
+
17
+
Possible exit codes and their meaning:
18
+
19
+
**0**: success, no vulnerabilities found\
20
+
**1**: action_needed, vulnerabilities found\
21
+
**2**: failure, try to re-run command\
22
+
**3**: failure, no supported projects detected
23
+
24
+
## Configure the Snyk CLI
25
+
26
+
You can use environment variables to configure the Snyk CLI and set variables for connecting with the Snyk API; see [Configure the Snyk CLI](https://docs.snyk.io/features/snyk-cli/configure-the-snyk-cli)
27
+
28
+
## Debug
29
+
30
+
Use the `-d` option to output the debug logs.
31
+
32
+
## Options for the code test subcommand
33
+
34
+
### `--org=<ORG_ID>`
35
+
36
+
Specify the `<ORG_ID>`to run Snyk commands tied to a specific organization. The `<ORG_ID>` influences private test limits.
37
+
38
+
If you have multiple organizations, you can set a default from the CLI using:
39
+
40
+
`$ snyk config set org=<ORG_ID>`
41
+
42
+
Set a default to ensure all newly tested projects are tested under your default organization. If you need to override the default, use the `--org=<ORG_ID>` option.
43
+
44
+
Default: `<ORG_ID>` that is the current preferred organization in your [Account settings](https://app.snyk.io/account)
45
+
46
+
Note that you can also use `--org=<orgslugname>`. The `ORG_ID` works in both the CLI and the API. The organization slug name works in the CLI, but not in the API.
47
+
48
+
For more information see the article [How to select the organization to use in the CLI](https://support.snyk.io/hc/en-us/articles/360000920738-How-to-select-the-organization-to-use-in-the-CLI)
49
+
50
+
### `--json`
51
+
52
+
Print results on the console as a JSON data structure.
53
+
54
+
Example: `$ snyk code test --json`
55
+
56
+
### `--json-file-output=<OUTPUT_FILE_PATH>`
57
+
58
+
Save test output as a JSON data structure directly to the specified file, regardless of whether or not you use the `--json` option.
59
+
60
+
Use to display the human-readable test output using stdout and at the same time save the JSON data structure output to a file. If no issues are found, an output file is not created.
61
+
62
+
Example: `$ snyk code test --json-file-output=vuln.json`
63
+
64
+
### `--sarif`
65
+
66
+
Return results in SARIF format.
67
+
68
+
Example: `$ snyk code --sarif`
69
+
70
+
### `--sarif-file-output=<OUTPUT_FILE_PATH>`
71
+
72
+
Save test output in SARIF format directly to the \<OUTPUT_FILE_PATH> file, regardless of whether or not you use the `--sarif` option.
73
+
74
+
Use to display the human-readable test output using stdout and at the same time save the SARIF format output to a file.
Report only vulnerabilities at the specified level or higher. Note that the Snyk Code configuration issues do not currently use the `critical` severity level.
Copy file name to clipboardExpand all lines: help/cli-commands/code.md
+4-67
Original file line number
Diff line number
Diff line change
@@ -2,79 +2,16 @@
2
2
3
3
## Usage
4
4
5
-
`snyk code [<SUBCOMMAND>] [<OPTIONS>] [<PATH>]`
5
+
`snyk code [<COMMAND>] [<OPTIONS>] [<PATH>]`
6
6
7
7
## Description
8
8
9
9
The `snyk code` command finds security issues using Static Code Analysis.
10
10
11
11
For more information see [CLI for Snyk Code](https://docs.snyk.io/snyk-code/cli-for-snyk-code)
12
12
13
-
## Subcommand: `test`
13
+
## `snyk code` command and the help docs
14
14
15
-
Test for any known issue.
15
+
The `snyk code` command is identified here with the help options:
16
16
17
-
## Exit codes
18
-
19
-
Possible exit codes and their meaning:
20
-
21
-
**0**: success, no vulnerabilities found\
22
-
**1**: action_needed, vulnerabilities found\
23
-
**2**: failure, try to re-run command\
24
-
**3**: failure, no supported projects detected
25
-
26
-
## Configure the Snyk CLI
27
-
28
-
You can use environment variables to configure the Snyk CLI and set variables for connecting with the Snyk API; see [Configure the Snyk CLI](https://docs.snyk.io/features/snyk-cli/configure-the-snyk-cli)
29
-
30
-
## Debug
31
-
32
-
Use the `-d` option to output the debug logs.
33
-
34
-
## Options for the code test subcommand
35
-
36
-
### `--org=<ORG_ID>`
37
-
38
-
Specify the `<ORG_ID>`to run Snyk commands tied to a specific organization. The `<ORG_ID>` influences private test limits.
39
-
40
-
If you have multiple organizations, you can set a default from the CLI using:
41
-
42
-
`$ snyk config set org=<ORG_ID>`
43
-
44
-
Set a default to ensure all newly tested projects are tested under your default organization. If you need to override the default, use the `--org=<ORG_ID>` option.
45
-
46
-
Default: `<ORG_ID>` that is the current preferred organization in your [Account settings](https://app.snyk.io/account)
47
-
48
-
Note that you can also use `--org=<orgslugname>`. The `ORG_ID` works in both the CLI and the API. The organization slug name works in the CLI, but not in the API.
49
-
50
-
For more information see the article [How to select the organization to use in the CLI](https://support.snyk.io/hc/en-us/articles/360000920738-How-to-select-the-organization-to-use-in-the-CLI)
51
-
52
-
### `--json`
53
-
54
-
Print results in JSON format.
55
-
56
-
Example: `$ snyk code test --json`
57
-
58
-
### `--json-file-output=<OUTPUT_FILE_PATH>`
59
-
60
-
Save test output in JSON format directly to the specified file, regardless of whether or not you use the `--json` option.
61
-
62
-
This is useful if you want to display the human-readable test output using stdout and at the same time save the JSON format output to a file.
63
-
64
-
Example: `$ snyk code test --json-file-output=vuln.json`
65
-
66
-
### `--sarif`
67
-
68
-
Return results in SARIF format.
69
-
70
-
Example: `$ snyk code --sarif`
71
-
72
-
### `--sarif-file-output=<OUTPUT_FILE_PATH>`
73
-
74
-
Save test output in SARIF format directly to the \<OUTPUT_FILE_PATH> file, regardless of whether or not you use the `--sarif` option.
75
-
76
-
This is especially useful if you want to display the human-readable test output using stdout and at the same time save the SARIF format output to a file.
Report only vulnerabilities at the specified level or higher. Note that the Snyk Code configuration issues do not currently use the `critical` severity level.
17
+
``[`code test`](code-test.md); `code test --help`: tests for any known security issues using Static Code Analysis
Copy file name to clipboardExpand all lines: help/cli-commands/container-monitor.md
+12-2
Original file line number
Diff line number
Diff line change
@@ -60,10 +60,12 @@ Manually pass a path to a `.snyk` policy file.
60
60
61
61
### `--json`
62
62
63
-
Print results in JSON format, useful for integrating with other tools
63
+
Print results on the console as a JSON data structure.
64
64
65
65
Example: `$ snyk container test --json`
66
66
67
+
Note: If you use an option that sets project attributes and your role lacks permission to edit project attributes the `monitor` command fails. For instructions on how to proceed see [Editing project attributes from the Snyk CLI](https://docs.snyk.io/features/user-and-group-management/managing-users-and-permissions/managing-permissions#editing-project-attributes-from-the-snyk-cli)
Set the project environment to one or more values (comma-separated). To clear the project environment set `--project-environment=`
@@ -98,7 +100,7 @@ To clear the project tags set `--project-tags=`
98
100
99
101
### `--tags=<TAG>[,<TAG>]...>`
100
102
101
-
This is an alias for `--projecttags`
103
+
This is an alias for `--project-tags`
102
104
103
105
### `--app-vulns`
104
106
@@ -108,6 +110,14 @@ In CLI version 1.962.0 and higher, use the `--app-vulns` option with the the `--
108
110
109
111
For more information see [Detecting application vulnerabilities in container images](https://docs.snyk.io/products/snyk-container/getting-around-the-snyk-container-ui/detecting-application-vulnerabilities-in-container-images)
110
112
113
+
### `--exclude-app-vulns`
114
+
115
+
Allow disabling scans for app vulnerabilities in advance of `app-vulns` being enabled by default.
116
+
117
+
Cannot be used with `--app-vulns`.
118
+
119
+
For more information see [Detecting application vulnerabilities in container images](https://docs.snyk.io/products/snyk-container/getting-around-the-snyk-container-ui/detecting-application-vulnerabilities-in-container-images)
120
+
111
121
### `--nested-jars-depth`
112
122
113
123
When using `--app-vulns` use the `--nested-jars-depth` option to set how many levels of nested jars Snyk is to unpack. Depth must be a number.
Copy file name to clipboardExpand all lines: help/cli-commands/container-test.md
+11-3
Original file line number
Diff line number
Diff line change
@@ -65,15 +65,15 @@ Manually pass a path to a `.snyk` policy file.
65
65
66
66
### `--json`
67
67
68
-
Print results in JSON format, useful for integrating with other tools
68
+
Print results ion the console as a JSON data structure.
69
69
70
70
Example: `$ snyk container test --json`
71
71
72
72
### `--json-file-output=<OUTPUT_FILE_PATH>`
73
73
74
-
Save test output in JSON format directly to the specified file, regardless of whether or not you use the `--json` option.
74
+
Save test output in JSON format as a JSON data structure directly to the specified file, regardless of whether or not you use the `--json` option.
75
75
76
-
This is especially useful if you want to display the human-readable test output using stdout and at the same time save the JSON format output to a file.
76
+
Use to display the human-readable test output using stdout and at the same time save the JSON data structure output to a file. If no issues are found, an output file is not created.
77
77
78
78
Example: `$ snyk container test --json-file-output=vuln.json`
79
79
@@ -108,6 +108,14 @@ In CLI version 1.962.0 and higher, use the `--app-vulns` option with the the `--
108
108
109
109
For more information see [Detecting application vulnerabilities in container images](https://docs.snyk.io/products/snyk-container/getting-around-the-snyk-container-ui/detecting-application-vulnerabilities-in-container-images)
110
110
111
+
### `--exclude-app-vulns`
112
+
113
+
Allow disabling scans for app vulnerabilities in advance of `app-vulns` being enabled by default.
114
+
115
+
Cannot be used with`--app-vulns`.
116
+
117
+
For more information see [Detecting application vulnerabilities in container images](https://docs.snyk.io/products/snyk-container/getting-around-the-snyk-container-ui/detecting-application-vulnerabilities-in-container-images)
118
+
111
119
### `--nested-jars-depth`
112
120
113
121
When using `--app-vulns` use the `--nested-jars-depth` option to set how many levels of nested jars Snyk is to unpack. Depth must be a number.
Copy file name to clipboardExpand all lines: help/cli-commands/iac-test.md
+17-5
Original file line number
Diff line number
Diff line change
@@ -65,15 +65,15 @@ Manually pass a path to a `.snyk` policy file.
65
65
66
66
### `--json`
67
67
68
-
Print results in JSON format.
68
+
Print results on the console as a JSON data structure.
69
69
70
70
Example: `$ snyk iac test --json`
71
71
72
72
### `--json-file-output=<OUTPUT_FILE_PATH>`
73
73
74
-
Save test output in JSON format directly to the specified file, regardless of whether or not you use the `--json` option.
74
+
Save test output as a JSON data structure directly to the specified file, regardless of whether or not you use the `--json` option.
75
75
76
-
This is especially useful if you want to display the human-readable test output using stdout and at the same time save the JSON format output to a file.
76
+
Use to display the human-readable test output using stdout and at the same time save the JSON data structure output to a file. If no issues are found, an output file is not created.
77
77
78
78
Example: `$ snyk iac test --json-file-output=vuln.json`
79
79
@@ -87,6 +87,8 @@ Save test output in SARIF format directly to the \<OUTPUT_FILE_PATH> file, regar
87
87
88
88
This is especially useful if you want to display the human-readable test output using stdout and at the same time save the SARIF format output to a file.
89
89
90
+
Note: If you use an option that sets project attributes and your role lacks permission to edit project attributes the `iac test` command fails. For instructions on how to proceed see [Editing project attributes from the Snyk CLI](https://docs.snyk.io/features/user-and-group-management/managing-users-and-permissions/managing-permissions#editing-project-attributes-from-the-snyk-cli)
For more information see [Project attributes](https://docs.snyk.io/getting-started/introduction-to-snyk-projects/view-project-information/project-attributes)
99
101
102
+
This option is not supported for Integrated IaC (Limited Availability).
For more information see [Project attributes](https://docs.snyk.io/getting-started/introduction-to-snyk-projects/view-project-information/project-attributes)
109
113
114
+
This option is not supported for Integrated IaC (Limited Availability).
For more information see [Project attributes](https://docs.snyk.io/getting-started/introduction-to-snyk-projects/view-project-information/project-attributes)
119
125
126
+
This option is not supported for Integrated IaC (Limited Availability).
127
+
120
128
### `--project-tags=<TAG>[,<TAG>]...>`
121
129
122
130
This can be used in combination with the `--report` option.
This option is not supported for Integrated IaC (Limited Availability).
139
+
130
140
### `--remote-repo-url=<URL>`
131
141
132
142
This can be used in combination with the `--report` option.
@@ -147,14 +157,16 @@ Note: This option cannot be used in combination with the `--rules` option.
147
157
148
158
Use this dedicated option for Custom Rules scanning to enable the IaC scans to use a custom rules bundle generated with the `snyk-iac-rules` SDK. See [`snyk-iac-rules` SDK](https://github.com/snyk/snyk-iac-rules#readme)
149
159
150
-
This option cannot be used if the custom rules settings were configured with the Snyk UI. Default: If the `--rules`flag is not specified, scan the configuration files using the internal Snyk rules only.
160
+
This option cannot be used if the custom rules settings were configured with the Snyk UI. Default: If the `--rules`option is not specified, scan the configuration files using the internal Snyk rules only.
151
161
152
162
Example: Scan the configuration files using custom rules and internal Snyk rules.
153
163
154
164
`--rules=bundle.tar.gz`
155
165
156
166
Note: This option can not be used in combination with the `--report` option.
157
167
168
+
This option is not supported for Integrated IaC (Limited Availability).
Copy file name to clipboardExpand all lines: help/cli-commands/monitor.md
+5-9
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,7 @@ Can be used with `--all-projects` and `--yarn-workspaces` to indicate directory
64
64
65
65
Example: `$ snyk test --all-projects --exclude=dir1,file2`
66
66
67
-
This will exclude any directories and files named "dir1" and "file2" when scanning for project manifest files. Such as: "./dir1", "./src/dir1", "./file2", "./src/file2", and so on.
67
+
This will exclude any directories and files named `dir1` and `file2` when scanning for project manifest files such as: `./dir1`, `./src/dir1`, `./file2`, `./src/file2` and so on.
68
68
69
69
### `--prune-repeated-subdependencies`, `-p`
70
70
@@ -148,7 +148,9 @@ Manually pass a path to a `.snyk` policy file.
148
148
149
149
### `--json`
150
150
151
-
Print results in JSON format.
151
+
Print results on the console as a JSON data structure.
152
+
153
+
Note: If you use an option that sets project attributes and your role lacks permission to edit project attributes the `monitor` command fails. For instructions on how to proceed see [Editing project attributes from the Snyk CLI](https://docs.snyk.io/features/user-and-group-management/managing-users-and-permissions/managing-permissions#editing-project-attributes-from-the-snyk-cli)
0 commit comments