aquasecurity/trivy is an OSS tool to detect vulnerabilities in Docker images. FutureVuls can import Trivy scan results, allowing you to manage container image vulnerabilities on FutureVuls.
For details on the supported languages and package ecosystems, refer to Trivy Supported OS.
There is also a method of scanning container images on a container registry by integrating with Amazon ECR or Google Artifact Registry. Refer to Scanning Vulnerabilities in Docker Images on Container Registries for more information.
However, as of July 2022, Trivy has higher vulnerability detection accuracy and can scan libraries in images. Therefore, we recommend using this method with Trivy.
You can use Trivy container image scanning in two ways:
Install Trivy in your local environment and upload the results of scanning container images to FutureVuls. You can choose between two installation modes: normal and lightweight. The differences are as follows:
Item | Description | Normal | Lightweight |
---|---|---|---|
Root permission | Whether root permission is required at installation | Required | Not required |
Supported environments | Local environments that can be set up | Reference | Linux in general |
Regular scans | Whether to scan images automatically on a regular basis | Supported | Not supported |
In the lightweight version, root permission is not required, but you need to manually scan container images periodically. To keep vulnerability information up to date by constantly synchronizing container image configuration with FutureVuls, we recommend using the normal version of the scan whenever possible.
To scan a new container image and register it with FutureVuls, follow these steps:
Add Server
on the Server tab and selecting Scan Container Images
.
<image name>:<tag>
format.<image name>:<latest>
./opt/vuls-trivy-saas/vuls-trivy-saas.sh &> /opt/vuls-trivy-saas/vuls-trivy.log
Registration is complete. For the normal version, the scanner will automatically start once a day to scan the target container images and reflect them in FutureVuls.
For the normal version, you can also use several scan options.
If the scan results are not reflected, refer to here.
If you want to update vulnerability information based on the registered configuration information of a container image that is already registered in FutureVuls, manually run the scan from FutureVuls.
If there are any changes to the container image configuration information registered in FutureVuls, follow these steps to reflect them in FutureVuls.
root
or vuls-trivy-saas
user:
/opt/vuls-trivy-saas/vuls-trivy-saas.sh &> /opt/vuls-trivy-saas/vuls-trivy.log
Update Configuration Information
button to open the dialog.
Integrate Trivy into your CI/CD pipeline and upload the scan results of container images to FutureVuls. This document provides an example using GitHub Actions. The sample YAML file for GitHub Actions is as follows.
Variable | Description | Required |
---|---|---|
VULS_SAAS_GROUPID | ID of the group to upload scan results to | ✅ |
VULS_SAAS_TOKEN | Token with scan permissions | ✅ |
DOCKERFILE_PATH | Path to the Dockerfile that generates the image | ✅ |
TARGET_IMAGE | Image to scanSpecify in the format of <image name>:<tag> |
✅ |
VULS_SAAS_UUID | UUID of the target imageSpecify a value generated with the uuidgen command or similar for new registrationsIf you specify the UUID of a registered server that manages the same image on FutureVuls, it will be an update process. |
✅ |
VULS_SAAS_UUID
.We recommend setting the following environment variables using encrypted secrets.
With this information, it is possible to upload scan results of any server to the specified group on FutureVuls.
In this example, a script file for scanning is used to perform the scan.
name: FutureVuls Docker Image Scan
on:
push
defaults:
run:
shell: bash
jobs:
docker-test:
name: FutureVuls Docker Image Scan
env:
VULS_SAAS_GROUPID: ${{ secrets.VULS_SAAS_GROUPID }}
VULS_SAAS_TOKEN: ${{ secrets.VULS_SAAS_TOKEN }}
DOCKERFILE_PATH: "docker/anything/Dockerfile"
TARGET_IMAGE: "imageName:tag"
VULS_SAAS_UUID: "xxxxxxxx"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: cached scan db
uses: actions/cache@v3
with:
path: vulndb/
key: trivy-vulndb
- name: scan and upload
env:
run: |
docker build . -f ${env.DOCKERFILE_PATH} -t ${env.TARGET_IMAGE}
curl -s https://installer.vuls.biz/vuls-trivy-light.sh | \
VULS_SAAS_GROUPID="${env.VULS_SAAS_GROUPID}" \
VULS_SAAS_TOKEN="${env.VULS_SAAS_TOKEN}" \
TARGET_IMAGE="${env.TARGET_IMAGE}" \
VULS_SAAS_UUID="${env.VULS_SAAS_UUID}" \
bash -s inst
In this example, scanning is performed using a Docker image for scanning.
name: FutureVuls Docker Image Scan
on:
push
defaults:
run:
shell: bash
jobs:
container-scan:
name: FutureVuls Docker Image Scan
env:
VULS_SAAS_GROUPID: xxx
VULS_SAAS_TOKEN: xxxxxxxxx
FVULS_AUTH_URL: "https://auth.vuls.biz/one-time-auth"
DOCKERFILE_PATH: "path/to/dockerfile"
TARGET_IMAGE: "image-name"
VULS_SAAS_UUID: xxxxxxxxx
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: cached scan db
uses: actions/cache@v3
with:
path: vulndb/
key: trivy-vulndb
- name: Build dockerfile
run: docker build . -f ${{ env.DOCKERFILE_PATH }} -t ${{ env.TARGET_IMAGE }}
- name: Scan the image and upload to FutureVuls
uses: docker://vuls/fvuls
with:
entrypoint: '/bin/sh'
args: |-
-c "\
set -eo pipefail
trivy -q --cache-dir vulndb/ image -f json --list-all-pkgs ${{ env.TARGET_IMAGE }} | \
trivy-to-vuls parse --stdin | \
future-vuls upload --stdin --group-id ${{ env.VULS_SAAS_GROUPID }} --token ${{ env.VULS_SAAS_TOKEN }} --uuid ${{ env.VULS_SAAS_UUID }} \
"
Refer to the FAQ