From 7bc377694cf077caa34f574155320b81cc3e8134 Mon Sep 17 00:00:00 2001 From: RAHMAT AL ZAMI <112936589+zamibd@users.noreply.github.com> Date: Sun, 29 Nov 2026 06:12:16 +0000 Subject: [PATCH] Scan every platform with Trivy and Docker Scout CI scanned only the amd64 image, on the assumption that all platforms carry the same packages. Each platform installs its own build of the Alpine packages, so scan arm64 and arm/v7 as well, and print Scout's report for the published image per platform. --- .github/workflows/ci.yml | 14 ++++++++------ README.md | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8875d39..e716354 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,10 +111,10 @@ jobs: # fixed package, whatever its severity: the build upgrades every # package, so a fixable finding means the image is not current. # Severities differ between scanners (Trivy and Docker Scout rate some - # CVEs differently), so filtering by severity would let some through. The packages are the same on - # both architectures, so one scan is enough. + # CVEs differently), so filtering by severity would let some through. + # Every platform is scanned: each one installs its own build of the + # Alpine packages. - name: Scan image for known vulnerabilities - if: matrix.arch == 'amd64' uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0 with: version: ${{ env.TRIVY_VERSION }} @@ -128,11 +128,12 @@ jobs: # 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 != '' + if: env.DOCKERHUB_PASSWORD != '' uses: docker/scout-action@b265cd48f8a1451d2680815b3e8dc4ed65ee16e7 # v1.30.0 with: command: cves image: local://nginx:ci + platform: ${{ matrix.platform }} only-fixed: true exit-code: true write-comment: false @@ -140,14 +141,15 @@ jobs: dockerhub-password: ${{ env.DOCKERHUB_PASSWORD }} # Report only: what Docker Scout currently says about the published - # image, for comparison with the build above. + # image for this platform, for comparison with the build above. - name: Docker Scout report for the published image - if: matrix.arch == 'amd64' && env.DOCKERHUB_PASSWORD != '' + if: 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 + platform: ${{ matrix.platform }} write-comment: false dockerhub-user: ${{ vars.DOCKERHUB_USERNAME || secrets.DOCKERHUB_USERNAME }} dockerhub-password: ${{ env.DOCKERHUB_PASSWORD }} diff --git a/README.md b/README.md index 1d890b1..a443589 100644 --- a/README.md +++ b/README.md @@ -277,7 +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. +- **Docker Scout** scan with the same rule, when the Docker Hub credentials are set. Both scanners check every platform (`amd64`, `arm64`, `arm/v7`). 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.