Skip to content

Commit 11171a3

Browse files
dhi: add get trivy vex repo (#23854)
<!--Delete sections as needed --> ## Description When using vexhub with Trivy, it needs to be setup before it works. https://deploy-preview-23854--docsdocker.netlify.app/dhi/how-to/scan/#trivy ## Related issues or tickets https://docker.slack.com/archives/C0A3X908ASG/p1765983906348749 ## Reviews <!-- Notes for reviewers here --> <!-- List applicable reviews (optionally @tag reviewers) --> - [ ] Technical review - [ ] Editorial review - [ ] Product review --------- Signed-off-by: Craig Osterhout <[email protected]>
1 parent 712483f commit 11171a3

File tree

1 file changed

+71
-9
lines changed

1 file changed

+71
-9
lines changed

content/manuals/dhi/how-to/scan.md

Lines changed: 71 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -187,27 +187,89 @@ packages and application dependencies.
187187
After installing Trivy, you can scan a Docker Hardened Image by pulling
188188
the image and running the scan command:
189189

190+
```console
191+
$ docker pull dhi.io/<image>:<tag>
192+
$ trivy image --scanners vuln dhi.io/<image>:<tag>
193+
```
194+
195+
To filter vulnerabilities using VEX statements, Trivy supports multiple
196+
approaches. Docker recommends using VEX Hub, which provides a seamless workflow
197+
for automatically downloading and applying VEX statements from configured
198+
repositories.
199+
200+
#### Using VEX Hub (recommended)
201+
202+
Configure Trivy to download the Docker Hardened Images advisories repository
203+
from VEX Hub. Run the following commands to set up the VEX repository:
204+
205+
```console
206+
$ trivy vex repo init
207+
$ cat << REPO > ~/.trivy/vex/repository.yaml
208+
repositories:
209+
- name: default
210+
url: https://github.com/aquasecurity/vexhub
211+
enabled: true
212+
username: ""
213+
password: ""
214+
token: ""
215+
- name: dhi-vex
216+
url: https://github.com/docker-hardened-images/advisories
217+
enabled: true
218+
REPO
219+
$ trivy vex repo list
220+
$ trivy vex repo download
221+
```
222+
223+
After setting up VEX Hub, you can scan a Docker Hardened Image with VEX filtering:
224+
190225
```console
191226
$ docker pull dhi.io/<image>:<tag>
192227
$ trivy image --scanners vuln --vex repo dhi.io/<image>:<tag>
193228
```
194229

230+
For example, scanning the `dhi.io/python:3.13` image:
231+
232+
```console
233+
$ trivy image --scanners vuln --vex repo dhi.io/python:3.13
234+
```
235+
195236
Example output:
196237

197238
```plaintext
198239
Report Summary
199240
200-
┌──────────────────────────────────────────────────────────────────────────────┬────────────┬─────────────────┬─────────┐
201-
│ Target │ Type │ Vulnerabilities │ Secrets │
202-
├──────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┼─────────┤
203-
│ dhi.io/<image>:<tag> (debian 12.11) │ debian │ 66 │ - │
204-
├──────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┼─────────┤
205-
│ opt/python-3.13.4/lib/python3.13/site-packages/pip-25.1.1.dist-info/METADATA │ python-pkg │ 0 │ - │
206-
└──────────────────────────────────────────────────────────────────────────────┴────────────┴─────────────────┴─────────┘
241+
┌─────────────────────────────────────────────────────────────────────────────┬────────────┬─────────────────┐
242+
│ Target │ Type │ Vulnerabilities │
243+
├─────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
244+
│ dhi.io/python:3.13 (debian 13.2) │ debian │ 0 │
245+
├─────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
246+
│ opt/python-3.13.11/lib/python3.13/site-packages/pip-25.3.dist-info/METADATA │ python-pkg │ 0 │
247+
└─────────────────────────────────────────────────────────────────────────────┴────────────┴─────────────────┘
248+
Legend:
249+
- '-': Not scanned
250+
- '0': Clean (no security findings detected)
207251
```
208252

209-
You should include the `--vex` flag to apply VEX statements during the scan,
210-
which filter out known non-exploitable CVEs.
253+
The `--vex repo` flag applies VEX statements from the configured repository during the scan,
254+
which filters out known non-exploitable CVEs.
255+
256+
#### Using local VEX files
257+
258+
In addition to VEX Hub, Trivy also supports the use of local VEX files for
259+
vulnerability filtering. You can download the VEX attestation that Docker
260+
Hardened Images provide and use it directly with Trivy.
261+
262+
First, download the VEX attestation for your image:
263+
264+
```console
265+
$ docker scout vex get dhi.io/<image>:<tag> --output vex.json
266+
```
267+
268+
Then scan the image with the local VEX file:
269+
270+
```console
271+
$ trivy image --scanners vuln --vex vex.json dhi.io/<image>:<tag>
272+
```
211273

212274
## Use VEX to filter known non-exploitable CVEs
213275

0 commit comments

Comments
 (0)