diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ab6e6e..fc945ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,8 +86,11 @@ jobs: REQUIRE_HTTP3: '1' run: tests/smoke.sh nginx:ci - # Fails on HIGH or CRITICAL vulnerabilities in the image's Alpine - # packages when a fixed package exists. The packages are the same on + # Fails on any vulnerability in the image's Alpine packages that has a + # 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. - name: Scan image for known vulnerabilities if: matrix.arch == 'amd64' @@ -95,6 +98,5 @@ jobs: with: image-ref: nginx:ci scanners: vuln - severity: HIGH,CRITICAL ignore-unfixed: true exit-code: '1' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8cf3005..7e66fee 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -202,7 +202,6 @@ jobs: with: image-ref: nginx:release-test scanners: vuln - severity: HIGH,CRITICAL ignore-unfixed: true exit-code: '1' diff --git a/Dockerfile b/Dockerfile index d890db5..bdbbd2a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -99,7 +99,12 @@ ENV NGINX_VERSION=${NGINX_VERSION} # UID/GID 101 matches the official nginx images, so existing volume # ownership keeps working. -RUN addgroup -g 101 -S nginx \ +# +# "apk upgrade" matters: the Alpine base image is only rebuilt for Alpine +# point releases, so the packages it ships (musl, zlib, ...) can be behind +# the repository's security fixes. "apk add" alone would keep them. +RUN apk upgrade --no-cache \ + && addgroup -g 101 -S nginx \ && adduser -S -D -H -u 101 -h /var/cache/nginx -s /sbin/nologin -G nginx -g nginx nginx \ && apk add --no-cache \ ca-certificates \ diff --git a/README.md b/README.md index bec2dad..136f53a 100644 --- a/README.md +++ b/README.md @@ -276,7 +276,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`, both on native runners. -- **Vulnerability scan** with Trivy: fails on HIGH or CRITICAL findings in the image's Alpine packages that have a fix available. 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. +- **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. [Dependabot](.github/dependabot.yml) opens weekly pull requests for new versions of the GitHub Actions, the Alpine base image and the test dependencies.