ci: scan the built image with trivy #16

Sammanfogat
supernaut sammanfogade 2 incheckningar från ci/image-vulnerability-scan in i main 2026-10-20 08:55:59 +00:00
Ägare

Closes #6

Scans the built image with Trivy (Apache-2.0) in ci and release. Lists all findings, fails on HIGH or CRITICAL with a fix available.

  • scripts/scan-image.sh: runs Trivy as a pinned container (version and digest), on an image saved with podman save.
  • Renovate bumps version and digest through a new regex manager in renovate.json.
  • Release scans before podman push, so a vulnerable image is never published.
  • Vulnerability DB comes anonymously from mirror.gcr.io/aquasec/trivy-db, falling back to ghcr.io/aquasecurity/trivy-db. No GitHub token.

Checked locally: alpine:3.10 fails (exit 1, CRITICAL apk-tools CVE-2021-36159), alpine:3.22 passes. shellcheck v0.10.0 is clean.

Operator steps

  • Push a throwaway branch with an old base digest in Containerfile (for example an older keycloak digest) and confirm ci fails at "Scan image (Trivy)". Delete the branch.
  • Confirm the ci runner can pull ghcr.io/aquasecurity/trivy and reach mirror.gcr.io or ghcr.io (egress, fail2ban).
  • On the first PR run, check the real image passes. If a fixable HIGH shows up, bump the base before merging.
Closes #6 Scans the built image with Trivy (Apache-2.0) in `ci` and `release`. Lists all findings, fails on HIGH or CRITICAL with a fix available. - `scripts/scan-image.sh`: runs Trivy as a pinned container (version and digest), on an image saved with `podman save`. - Renovate bumps version and digest through a new regex manager in `renovate.json`. - Release scans before `podman push`, so a vulnerable image is never published. - Vulnerability DB comes anonymously from `mirror.gcr.io/aquasec/trivy-db`, falling back to `ghcr.io/aquasecurity/trivy-db`. No GitHub token. Checked locally: `alpine:3.10` fails (exit 1, CRITICAL apk-tools CVE-2021-36159), `alpine:3.22` passes. shellcheck v0.10.0 is clean. Operator steps - [ ] Push a throwaway branch with an old base digest in `Containerfile` (for example an older keycloak digest) and confirm `ci` fails at "Scan image (Trivy)". Delete the branch. - [ ] Confirm the `ci` runner can pull `ghcr.io/aquasecurity/trivy` and reach `mirror.gcr.io` or `ghcr.io` (egress, fail2ban). - [ ] On the first PR run, check the real image passes. If a fixable HIGH shows up, bump the base before merging.
supernaut lade till 1 incheckning 2026-10-19 19:11:12 +00:00
ci: scan built image with trivy
En del kontroller misslyckades
ci / ci (pull_request) Failing after 1m51s
efb426d588
The image fronts all sign-ins. A base-layer CVE was invisible until a bump PR.
Fails on fixable HIGH/CRITICAL in ci and, before push, in release.

Refs #6
supernaut lade till 1 incheckning 2026-10-20 08:10:59 +00:00
fix(ci): keep the scan work dir off the tmpfs /tmp
En del kontroller misslyckades
ci / ci (pull_request) Failing after 3m15s
19bdefc998
The runner's /tmp is a RAM-sized tmpfs, and the Trivy DB download failed
with no space left on device.
supernaut refererade denna ändringsförfrågan från en incheckning 2026-10-20 08:50:16 +00:00
supernaut tvångsskickade ci/image-vulnerability-scan från 19bdefc998
En del kontroller misslyckades
ci / ci (pull_request) Failing after 3m15s
till b69817eed3
Alla kontroller lyckades
ci / ci (pull_request) Successful in 3m57s
2026-10-20 08:51:20 +00:00
Jämför
supernaut sammanfogade incheckning 6bffbfe2de till main 2026-10-20 08:55:59 +00:00
supernaut tog bort grenen ci/image-vulnerability-scan 2026-10-20 08:55:59 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-10-20 08:56:01 +00:00
Logga in för att delta i denna konversation.
Inga granskare
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-keycloak!16
Ingen beskrivning angiven.