diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed21f28..6e023f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,3 +115,32 @@ jobs: scanners: vuln ignore-unfixed: true exit-code: '1' + + # Docker Scout uses its own vulnerability data, which can disagree with + # Trivy's (CVE-2026-107891 in musl was reported only by Scout). This is + # what Docker Hub shows for the image, so the build has to pass it too. + # Needs the Docker Hub credentials; skipped without them. + - name: Scan image with Docker Scout + if: matrix.arch == 'amd64' && env.DOCKERHUB_PASSWORD != '' + uses: docker/scout-action@b265cd48f8a1451d2680815b3e8dc4ed65ee16e7 # v1.30.0 + with: + command: cves + image: local://nginx:ci + only-fixed: true + exit-code: true + write-comment: false + dockerhub-user: ${{ vars.DOCKERHUB_USERNAME || secrets.DOCKERHUB_USERNAME }} + dockerhub-password: ${{ env.DOCKERHUB_PASSWORD }} + + # Report only: what Docker Scout currently says about the published + # image, for comparison with the build above. + - name: Docker Scout report for the published image + if: matrix.arch == 'amd64' && env.DOCKERHUB_PASSWORD != '' + continue-on-error: true + uses: docker/scout-action@b265cd48f8a1451d2680815b3e8dc4ed65ee16e7 # v1.30.0 + with: + command: cves + image: registry://docker.io/${{ vars.DOCKERHUB_IMAGE || format('{0}/nginx', vars.DOCKERHUB_USERNAME || secrets.DOCKERHUB_USERNAME) }}:latest + write-comment: false + dockerhub-user: ${{ vars.DOCKERHUB_USERNAME || secrets.DOCKERHUB_USERNAME }} + dockerhub-password: ${{ env.DOCKERHUB_PASSWORD }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 87c6a85..1a2056e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -205,6 +205,20 @@ jobs: ignore-unfixed: true exit-code: '1' + # Same check as Docker Hub's own scanner, so a release is not published + # with a finding Docker Hub would show. Runs when Docker Hub is set up. + - name: Scan image with Docker Scout + if: steps.registries.outputs.dockerhub == 'true' + uses: docker/scout-action@b265cd48f8a1451d2680815b3e8dc4ed65ee16e7 # v1.30.0 + with: + command: cves + image: local://nginx:release-test + only-fixed: true + exit-code: true + write-comment: false + dockerhub-user: ${{ vars.DOCKERHUB_USERNAME || secrets.DOCKERHUB_USERNAME }} + dockerhub-password: ${{ secrets.DOCKERHUB_PASSWORD }} + - name: Log in to GHCR uses: docker/login-action@v4 with: diff --git a/README.md b/README.md index cfe99b2..1d890b1 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ ![Non-root](https://img.shields.io/badge/runs%20as-non--root-success) ![Platforms](https://img.shields.io/badge/platforms-amd64%20%7C%20arm64%20%7C%20arm%2Fv7-informational) ![Base](https://img.shields.io/badge/base-Alpine-0D597F?logo=alpinelinux&logoColor=white) -![Vulnerability scan](https://img.shields.io/badge/scanned%20by-Trivy-1904DA) +![Vulnerability scan](https://img.shields.io/badge/scanned%20by-Trivy%20%7C%20Docker%20Scout-1904DA) [![Dependabot](https://img.shields.io/badge/Dependabot-enabled-025E8C?logo=dependabot)](.github/dependabot.yml) A small, hardened nginx image built from source: HTTP/1.1, HTTP/2 and HTTP/3 (QUIC) on the standard ports, running entirely as a non-root user. @@ -277,6 +277,7 @@ The smoke test starts the image read-only with all capabilities dropped and chec - **Lint**: hadolint for the Dockerfile, ShellCheck for the scripts, actionlint for the workflows. - **Build and smoke test** on `amd64` and `arm64` on native runners, and on `arm/v7` under QEMU emulation. - **Vulnerability scan** with Trivy: fails on any finding in the image's Alpine packages that has a fix available, whatever its severity. The build runs `apk upgrade`, so every fixed package Alpine has published is in the image. nginx itself and the two modules are compiled from source, so they are not covered by the scan; keep them current through the pinned versions above. +- **Docker Scout** scan with the same rule, when the Docker Hub credentials are set. Scout is what Docker Hub shows for the image and its data can differ from Trivy's, so both have to pass. The log also shows Scout's current report for the published image. [Dependabot](.github/dependabot.yml) opens weekly pull requests for new versions of the GitHub Actions, the Alpine base image and the test dependencies.