@@ -9,9 +9,8 @@ keywords: scout, cves, suppress, vex, exceptions
99
1010Vulnerabilities found in container images sometimes need additional context.
1111Just because an image contains a vulnerable package, it doesn't mean that the
12- vulnerability is exploitable. ** Exceptions** in Docker Scout lets you address
13- false positives in image analysis using Vulnerability Exploitability
14- eXchange (VEX) documents.
12+ vulnerability is exploitable. ** Exceptions** in Docker Scout lets you
13+ acknowledge accepted risks or address false positives in image analysis.
1514
1615By negating non-applicable vulnerabilities, you can make it easier for yourself
1716and downstream consumers of your images to understand the security implications
@@ -21,296 +20,84 @@ In Docker Scout, exceptions are automatically factored into the results.
2120If an image contains an exception that flags a CVE as non-applicable,
2221then that CVE is excluded from analysis results.
2322
24- ## Create an exception
23+ ## Create exceptions
2524
26- To add an exception to an image, you need a VEX document. VEX is a standard
27- format for documenting vulnerabilities in the context of a software package or
28- product.
25+ To create an exception for an image, you can:
2926
30- There are multiple implementations and formats of VEX. Docker Scout supports
31- the [ OpenVex] ( https://github.com/openvex/spec ) implementation. To create an
32- OpenVEX document, use the [ ` vexctl ` ] ( https://github.com/openvex/vexctl ) command
33- line tool.
27+ - Create an exception in the [ GUI] ( /scout/how-tos/create-exceptions-gui.md ) of
28+ Docker Scout Dashboard.
3429
35- The following example command creates a VEX document stating that:
30+ - Create a [ VEX] ( /scout/how-tos/create-exceptions-vex.md ) document and attach
31+ it to the image.
3632
37- - The software product described by this VEX document is the Docker image
38- ` example/app:v1 `
39- - The image contains the npm package
` [email protected] ` 40- - The npm package is affected by a known vulnerability: ` CVE-2022-24999 `
41- - The image is unaffected by the CVE, because the vulnerable code is never
42- executed in containers that run this image
33+ The recommended way to create exceptions is to use Docker Scout Dashboard. The
34+ GUI provides a user-friendly interface for creating exceptions. It also lets
35+ you create exceptions for multiple images, or your entire organization, all at
36+ once.
4337
44- ``` console
45- $ vexctl create \
46- 47- --product="pkg:docker/example/app@v1" \
48- --subcomponents="pkg:npm/[email protected] " \ 49- --vuln="CVE-2022-24999" \
50- --status="not_affected" \
51- --justification="vulnerable_code_not_in_execute_path" \
52- --file="CVE-2022-24999.vex.json"
53- ```
54-
55- Here's a description of the options in this example:
56-
57- ` --author `
58- : The email of the author of the VEX document.
59-
60- ` --product `
61- : Package URL (PURL) of the Docker image. A PURL is an identifier
62- for the image in a standardized format, defined in the PURL
63- [ specification] ( https://github.com/package-url/purl-spec/blob/master/PURL-TYPES.rst#docker ) .
64-
65- Docker image PURL strings begin with a ` pkg:docker ` type prefix, followed by
66- the image repository and version (the image tag or SHA256 digest). Unlike
67- image tags, where the version is specified like ` example/app:v1 ` , in PURL the
68- image repository and version are separated by an ` @ ` .
69-
70- ` --subcomponents `
71- : PURL of the vulnerable package in the image. In this example, the
72- vulnerability exists in an npm package, so the ` --subcomponents ` PURL is the
73- identifier for the npm package name and version (
` pkg:npm/[email protected] ` ).
74-
75- If the same vulnerability exists in multiple packages, ` vexctl ` lets you
76- specify the ` --subcomponents ` flag multiple times for a single ` create `
77- command.
78-
79- You can also omit ` --subcomponents ` , in which case the VEX statement applies
80- to the entire image.
81-
82- ` --vuln `
83- : ID of the CVE that the VEX statement addresses.
84-
85- ` --status `
86- : This is the status label of the vulnerability. This describes the
87- relationship between the software (` --product ` ) and the CVE (` --vuln ` ).
88- The possible values for the status label in OpenVEX are:
89-
90- - ` not_affected `
91- - ` affected `
92- - ` fixed `
93- - ` under_investigation `
94-
95- In this example, the VEX statement asserts that the Docker image is
96- ` not_affected ` by the vulnerability. The ` not_affected ` status is the only
97- status that results in CVE suppression, where the CVE is filtered out of the
98- analysis results. The other statuses are useful for documentation purposes,
99- but they do not work for creating exceptions. For more information about all
100- the possible status labels, see [ Status Labels] ( https://github.com/openvex/spec/blob/main/OPENVEX-SPEC.md#status-labels )
101- in the OpenVEX specification.
102-
103- ` --justification `
104- : Justifies the ` not_affected ` status label, informing why the product is not
105- affected by the vulnerability. In this case, the justification given is
106- ` vulnerable_code_not_in_execute_path ` , signalling that the vulnerability
107- can't be executed as used by the product.
108-
109- In OpenVEX, status justifications can have one of the five possible values:
110-
111- - ` component_not_present `
112- - ` vulnerable_code_not_present `
113- - ` vulnerable_code_not_in_execute_path `
114- - ` vulnerable_code_cannot_be_controlled_by_adversary `
115- - ` inline_mitigations_already_exist `
116-
117- For more information about these values and their definitions, see
118- [ Status Justifications] ( https://github.com/openvex/spec/blob/main/OPENVEX-SPEC.md#status-justifications )
119- in the OpenVEX specification.
120-
121- ` --file `
122- : Filename of the VEX document output
123-
124- Here's the OpenVEX JSON generated by this command:
125-
126- ``` json
127- {
128- "@context" : " https://openvex.dev/ns/v0.2.0" ,
129- "@id" : " https://openvex.dev/docs/public/vex-749f79b50f5f2f0f07747c2de9f1239b37c2bda663579f87a35e5f0fdfc13de5" ,
130- 131- "timestamp" : " 2024-05-27T13:20:22.395824+02:00" ,
132- "version" : 1 ,
133- "statements" : [
134- {
135- "vulnerability" : {
136- "name" : " CVE-2022-24999"
137- },
138- "timestamp" : " 2024-05-27T13:20:22.395829+02:00" ,
139- "products" : [
140- {
141- "@id" : " pkg:docker/example/app@v1" ,
142- "subcomponents" : [
143- {
144- "@id" :
" pkg:npm/[email protected] " 145- }
146- ]
147- }
148- ],
149- "status" : " not_affected" ,
150- "justification" : " vulnerable_code_not_in_execute_path"
151- }
152- ]
153- }
154- ```
155-
156- Understanding how VEX documents are supposed to be structured can be a bit of a
157- mouthful. The [ OpenVEX specification] ( https://github.com/openvex/spec )
158- describes the format and all the possible properties of documents and
159- statements. For the full details, refer to the specification to learn more
160- about the available fields and how to create a well-formed OpenVEX document.
161-
162- To learn more about the available flags and syntax of the ` vexctl ` CLI tool and
163- how to install it, refer to the [ ` vexctl ` GitHub repository] ( https://github.com/openvex/vexctl ) .
164-
165- For an introduction to VEX, you may also want to check out this use-case guide:
166- [ Suppress image vulnerabilities with VEX] ( /scout/guides/vex.md ) .
167-
168- ## Verifying VEX documents
169-
170- To test whether the VEX documents you create are well-formed and produce the
171- expected results, use the ` docker scout cves ` command with the ` --vex-location `
172- flag to apply a VEX document to a local image analysis using the CLI.
173-
174- The following command invokes a local image analysis that incorporates all VEX
175- documents in the specified location, using the ` --vex-location ` flag. In this
176- example, the CLI is instructed to look for VEX documents in the current working
177- directory.
178-
179- ``` console
180- $ docker scout cves < IMAGE> --vex-location .
181- ```
182-
183- The output of the ` docker scout cves ` command displays the results with any VEX
184- statements found in under the ` --vex-location ` location factored into the
185- results. For example, CVEs assigned a status of ` not_affected ` are filtered out
186- from the results. If the output doesn't seem to take the VEX statements into
187- account, that's an indication that the VEX documents might be invalid in some
188- way.
189-
190- Things to look out for include:
191-
192- - The PURL of a Docker image must begin with ` pkg:docker/ ` followed by the image name.
193- - In a Docker image PURL, the image name and version is separated by ` @ ` .
194- An image named
` example/myapp:1.0 ` has the following PURL:
` pkg:docker/example/[email protected] ` .
195- - Remember to specify an ` author ` (it's a mandatory field in OpenVEX)
196- - The [ OpenVEX specification] ( https://github.com/openvex/spec ) describes how
197- and when to use ` justification ` , ` impact_statement ` , and other fields in the
198- VEX documents. Specifying these in an incorrect way results in an invalid
199- document. Make sure your VEX documents comply with the OpenVEX specification.
200-
201- ## Attach exceptions to images
202-
203- When you've created an exception,
204- you can attach it to your image in the following ways:
205-
206- - Attach the document as an [ attestation] ( #attestation )
207- - Embed the document in the [ image filesystem] ( #image-filesystem )
208-
209- You can't remove a VEX document from an image once it's been added. For
210- documents attached as attestations, you can create a new VEX document and
211- attach it to the image again. Doing so will overwrite the previous VEX document
212- (but it won't remove the attestation). For images where the VEX document has
213- been embedded in the image's filesystem, you need to rebuild the image to
214- change the VEX document.
215-
216- ### Attestation
217-
218- To attach exceptions as an attestation, you can use the `docker scout
219- attestation add` CLI command. Using attestations is the recommended option for attaching exceptions to
220- images.
38+ ## View exceptions
22139
222- You can attach attestations to images that have already been pushed to a
223- registry. You don't need to build or push the image again. Additionally, having
224- the exceptions attached to the image as attestations means consumers can
225- inspect the exceptions for an image, directly from the registry.
40+ To view exceptions for images, you need to have the appropriate permissions.
22641
227- To attach an attestation to an image:
42+ - Exceptions created [ using the GUI] ( /scout/how-tos/create-exceptions-gui.md )
43+ are visible to members of your Docker organization. Unauthenticated users or
44+ users who aren't members of your organization cannot see these exceptions.
45+ - Exceptions created [ using VEX documents] ( /scout/how-tos/create-exceptions-vex.md )
46+ are visible to anyone who can pull the image, since the VEX document is
47+ stored in the image manifest or on filesystem of the image.
22848
229- 1 . Build the image and push it to a registry.
49+ ### View exceptions in Docker Scout Dashboard
23050
231- ``` console
232- $ docker build --provenance=true --sbom=true --tag <IMAGE> --push .
233- ```
51+ The [ ** Exceptions** tab] ( https://scout.docker.com/reports/vulnerabilities/exceptions )
52+ of the Vulnerabilities page in Docker Scout Dashboard lists all exceptions for
53+ for all images in your organization. From here, you can see more details about
54+ each exception, the CVEs being suppressed, the images that exceptions apply to,
55+ the type of exception and how it was created, and more.
23456
235- 2 . Attach the exception to the image as an attestation.
57+ For exceptions created using the [ GUI] ( /scout/how-tos/create-exceptions-gui.md ) ,
58+ selecting the action menu lets you edit or remove the exception.
23659
237- ``` console
238- $ docker scout attestation add \
239- --file <cve-id>.vex.json \
240- --predicate-type https://openvex.dev/ns/v0.2.0 \
241- <IMAGE>
242- ```
60+ To view all exceptions for a specific image tag:
24361
244- The options for this command are:
62+ 1 . Go to the [ Images page] ( https://scout.docker.com/reports/images ) .
63+ 2 . Select the tag that you want to inspect.
64+ 3 . Open the ** Exceptions** tab.
24565
246- - ` --file ` : the location and filename of the VEX document
247- - ` --predicate-type ` : the in-toto ` predicateType ` for OpenVEX
66+ ### View exceptions in the CLI
24867
249- ### Image filesystem
68+ {{% experimental %}}
69+ Viewing exceptions in the CLI is an experimental feature.
70+ It requires the latest version of the Docker Scout CLI plugin.
71+ Some exceptions may not appear correctly in the CLI.
72+ {{% /experimental %}}
25073
251- Embedding exceptions directly on the image filesystem is a good option if you
252- know the exceptions ahead of time, before you build the image. And it's easy;
253- just ` COPY ` the VEX document to the image in your Dockerfile .
74+ Vulnerability exceptions are highlighted in the CLI when you run `docker scout
75+ cves < image > ` . If a CVE is suppressed by an exception, a ` SUPPRESSED` label
76+ appears next to the CVE ID. Details about the exception are also displayed .
25477
255- The downside with this approach is that you can't change or update the
256- exception later. Image layers are immutable, so anything you put in the image's
257- filesystem is there forever. Attaching the document as an
258- [ attestation] ( #attestation ) provides better flexibility.
78+ ![ SUPPRESSED label in the CLI output] ( /scout/images/suppressed-cve-cli.png )
25979
260- > [ !NOTE]
80+ > [ !IMPORTANT]
81+ > In order to view exceptions in the CLI, you must configure the CLI to use
82+ > the same Docker organization that you used to create the exceptions.
26183>
262- > VEX documents embedded in the image filesystem are not considered for images
263- > that have attestations. If your image has ** any** attestations, Docker Scout
264- > will only look for exceptions in the attestations, and not in the image
265- > filesystem.
84+ > To configure an organization for the CLI, run:
26685>
267- > If you want to use the VEX document embedded in the image filesystem, you
268- > must remove the attestation from the image. Note that provenance attestations
269- > may be added automatically for images. To ensure that no attestations are
270- > added to the image, you can explicitly disable both SBOM and provenance
271- > attestations using the ` --provenance=false ` and ` --sbom=false ` flags when
272- > building the image.
273-
274- To embed a VEX document on the image filesystem, ` COPY ` the file into the image
275- as part of the image build. The following example shows how to copy all VEX
276- documents under ` .vex/ ` in the build context, to ` /var/lib/db ` in the image.
86+ > ``` console
87+ > $ docker scout configure organization < organization>
88+ > ` ` `
89+ >
90+ > Replace ` < organization> ` with the name of your Docker organization.
91+ >
92+ > You can also set the organization on a per-command basis by using the
93+ > ` --org` flag:
94+ >
95+ > ` ` ` console
96+ > $ docker scout cves --org < organization> < image>
97+ > ` ` `
27798
278- ``` dockerfile
279- # syntax=docker/dockerfile:1
99+ To exclude suppressed CVEs from the output, use the `--ignore-suppressed` flag:
280100
281- FROM alpine
282- COPY .vex/* /var/lib/db/
101+ ```console
102+ $ docker scout cves --ignore-suppressed < image >
283103```
284-
285- The filename of the VEX document must match the ` *.vex.json ` glob pattern.
286- It doesn't matter where on the image's filesystem you store the file.
287-
288- Note that the copied files must be part of the filesystem of the final image,
289- For multi-stage builds, the documents must persist in the final stage.
290-
291- ## View exceptions
292-
293- The ** Exceptions** page on the [ Docker Scout Dashboard] ( https://scout.docker.com/ )
294- lists the exceptions for all images in your organization. Selecting a row in
295- the list opens the exception side panel, which displays more information about
296- the exception and where it comes from.
297-
298- To view all exceptions for a specific image tag:
299-
300- {{< tabs >}}
301- {{< tab name="Docker Scout Dashboard" >}}
302-
303- 1 . Go to the [ Images page] ( https://scout.docker.com/reports/images ) .
304- 2 . Select the tag that you want to inspect.
305- 3 . Open the ** Image attestations** tab.
306-
307- {{< /tab >}}
308- {{< tab name="Docker Desktop" >}}
309-
310- 1 . Open the ** Images** view in Docker Desktop.
311- 2 . Open the ** Hub** tab.
312- 3 . Select the tag you want to inspect.
313- 4 . Open the ** Image attestations** tab.
314-
315- {{< /tab >}}
316- {{< /tabs >}}
0 commit comments