Skip to content

fix: patch base image CVEs and let Dependabot track it - #140

Merged
oto-macenauer-absa merged 1 commit into
masterfrom
fix/base-image-cve
Nov 6, 2026
Merged

oto-macenauer-absa merged 1 commit into
masterfrom
fix/base-image-cve

Conversation

@oto-macenauer-absa

Copy link
Copy Markdown
Collaborator

What

The Image build + integration + scan job fails on every branch, including #139, because Trivy reports a critical CVE in the runtime base image:

Package CVE Installed Fixed
brotli-libs CVE-2026-111497 (CRITICAL) 1.2.0-r0 1.2.1-r0

The pinned nginx-unprivileged:1.29-alpine tag has not been rebuilt since May. Even the current 1.31-alpine image still ships the vulnerable package; the fix is only in the Alpine repositories so far.

Changes

  • Dockerfile:
    • Bump the base image to nginx-unprivileged:1.31-alpine (nginx 1.31.7, Alpine 3.24), still pinned by digest.
    • Run apk upgrade --no-cache as root, then switch back to UID 101. Alpine security fixes then land without waiting for an upstream rebuild.
  • .github/dependabot.yml: add the docker ecosystem. The Dockerfile comment said Dependabot bumps the tag, but no ecosystem was configured, which is how the base image went stale.

Verification

Run locally against the image built from this branch:

  • npm run test:container: 37 passed against the real image.
  • Trivy 0.70 (the version CI uses), --severity CRITICAL,HIGH --ignore-unfixed: 0 findings. Before this change, the old image had 1 critical finding, and plain 1.31-alpine had 8 (1 critical, 7 high).
  • The container still runs as uid=101(nginx).

🤖 Generated with Claude Code

The image scan failed on CVE-2026-111497 (critical, brotli-libs
1.2.0-r0, fixed in 1.2.1-r0). The pinned nginx-unprivileged:1.29-alpine
tag has not been rebuilt upstream since May, and even the current
1.31-alpine still ships the vulnerable package; Alpine has the fix.

- Bump the base to nginx-unprivileged:1.31-alpine (Alpine 3.24), pinned
  by digest.
- Run `apk upgrade --no-cache` as root, then drop back to UID 101, so
  Alpine security fixes land without waiting for an upstream rebuild.
- Add the docker ecosystem to Dependabot. The Dockerfile already said
  Dependabot bumps the tag, but nothing did, which is how the base went
  stale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oto-macenauer-absa
oto-macenauer-absa merged commit 3384b51 into master Nov 6, 2026
8 checks passed
@oto-macenauer-absa
oto-macenauer-absa deleted the fix/base-image-cve branch November 6, 2026 11:18
oto-macenauer-absa added a commit that referenced this pull request Nov 6, 2026
## Problem

Since #140 the image build runs `apk upgrade`, which fetches from
`https://dl-cdn.alpinelinux.org`. Behind a TLS-intercepting corporate
proxy it fails with `TLS: server certificate not trusted` (exit 99): the
proxy re-signs with a corporate CA the base image does not trust.

## Fix

Same pattern as AbsaOSS/EventGate's Dockerfile:

- `ARG TRUSTED_SSL_CERTS=./trusted_certs` + `COPY` into `/opt/certs/`;
every `*.pem`/`*.crt` there is appended to
`/etc/ssl/certs/ca-certificates.crt` before `apk upgrade`.
- `trusted_certs/` is committed empty (`.gitkeep`; everything else
gitignored), so a plain `docker build` is unchanged.
- `build-image.yml` takes an optional `ca-certificates` secret (PEM) and
writes it to `trusted_certs/` before building.
- `contract/DEPLOYMENT.md` documents it under *Private networks*.

Notes: the certificate file stays at `/opt/certs/` in the image. The
`ca-certificates` package upgrade regenerates the system bundle, so the
shipped bundle is the stock one.

## Verification (local)

- apk trusts exactly the OpenSSL default bundle: with a single unrelated
CA it fails with the same `server certificate not trusted`.
- Build with empty `trusted_certs/`: succeeds.
- Build with a cert dropped in (no trailing newline): appended, upgrade
succeeds.
- `private-registry.spec.js`, `nginx-config.spec.js` pass.
- Not yet tested behind the real corporate proxy.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant