build(release): 기본 이미지를 noble로 올리고 이미지 검사를 취약점과 라이선스로 나눈다
pr / done (pull_request) Failing after 12m44s
pr / done (pull_request) Failing after 12m44s
문제: release 수동 실행(run 62)의 app-image-release가 Trivy에서 실패한다. 기본
이미지 eclipse-temurin:21-jre-jammy(ubuntu 22.04)에 고친 버전이 있는 OS 취약점
HIGH 7건(apt, libssl3/openssl, libbrotli1 등)과 OS 패키지 라이선스 HIGH 370건이
걸렸다. 앱 jar는 0건이다.
고른 방법(2026-11-11 소유자 결정 「권하는 안」):
- builder·runtime을 eclipse-temurin:21-{jdk,jre}-noble(ubuntu 24.04.5)의
2026-10-29 digest로 올린다. noble 이미지에는 uid·gid 1000인 `ubuntu` 계정이
있어, 앱 계정(uid 1000)을 만들기 전에 지운다. wget(healthcheck)과 C.UTF-8은
noble에도 있다(desktop에서 확인).
- 취약점: OS·앱 모두 High/Critical이면 실패를 유지한다. 고친 버전이 있으면
새 digest로 고치고, 아직 없는 것만 .trivyignore.yaml에 만료일 예외로 둔다.
- 라이선스: 앱 의존성(`--pkg-types library`)의 금지 라이선스(Trivy CRITICAL)만
실패. OS 패키지 것을 포함한 나머지는 보고만 한다.
- 정책 문서(.github/dependency-vulnerability-policy.md)에 같은 내용을 적는다.
위험·한계: noble로 바꾸며 아직 고친 버전이 없는 High가 새로 보일 수 있다.
그때는 이유와 만료일을 달아 예외로 둔다. PR의 filesystem 검사는 그대로라
앱 의존성의 restricted(HIGH) 라이선스는 PR에서 여전히 막힌다.
검증: runner release 수동 실행의 app-image-release(이 PR 본문에 적는다),
desktop compose smoke(같은 Dockerfile로 qualification 이미지를 만든다).
This commit is contained in:
@@ -21,6 +21,15 @@ GitHub dependency review와 dependency submission은 GitHub.com API에만 있어
|
||||
이미지 빌드·스캔, SBOM, 서명, 태그 릴리스는 `.gitea/workflows/release.yml`이 맡는다. 이미지 스캔도 같은
|
||||
스크립트(`image` 모드)와 같은 예외 파일을 쓴다.
|
||||
|
||||
릴리스 이미지(2026-11-11 소유자 결정):
|
||||
|
||||
- 기본 이미지는 고칠 수 있는 최신 digest로 둔다(`Dockerfile`, 지금 `eclipse-temurin:21-jre-noble`).
|
||||
OS 패키지의 High/Critical도 아래 표대로 막는다. 고친 버전이 있으면 새 digest로 고친다.
|
||||
- 아직 고친 버전이 없는 High/Critical만 `.trivyignore.yaml`에 이유와 `expired_at`을 달아 둔다.
|
||||
- 라이선스: 앱 의존성(`--pkg-types library`)의 금지 라이선스(Trivy CRITICAL)만 막는다. 그 밖의 라이선스
|
||||
결과는 OS 패키지 것까지 보고만 한다. 배포판의 GPL 패키지는 이 애플리케이션의 이용 조건이 아니다.
|
||||
- pull request의 `filesystem` 검사는 그대로다(앱 의존성의 High/Critical 라이선스도 막는다).
|
||||
|
||||
## 심각도와 대응
|
||||
|
||||
| 심각도 | CI 처리 | 고칠 기한 |
|
||||
|
||||
+14
-7
@@ -23,8 +23,9 @@ ARG GIT_SHA
|
||||
ARG SOURCE_URL
|
||||
|
||||
# ---- Stage 1: builder -------------------------------------------------------
|
||||
# Uses the full JDK only in the build stage, never in the final image.
|
||||
FROM eclipse-temurin:21-jdk-jammy@sha256:801b7e1a9c4befaf82bf9a2a58025ef43a7694bbc84779187ad0524d84742772 AS builder
|
||||
# Uses the full JDK only in the build stage, never in the final image. Same Ubuntu release as the
|
||||
# runtime stage below.
|
||||
FROM eclipse-temurin:21-jdk-noble@sha256:114cabb73033ca4ce7ceec3deb62396bc1b716282bae051ed3c1d82e38fcab2d AS builder
|
||||
|
||||
ARG RELEASE_VERSION
|
||||
ARG GIT_SHA
|
||||
@@ -104,8 +105,11 @@ RUN java -Djarmode=tools \
|
||||
|
||||
# ---- Stage 2: runtime image -------------------------------------------------
|
||||
# JRE-only slim image (D3: no full JDK in production image).
|
||||
# Uses eclipse-temurin:21-jre-jammy — the Adoptium-supported JRE variant.
|
||||
FROM eclipse-temurin:21-jre-jammy@sha256:199aebeb3adcde4910695cdebfe782ada38dadb6cc8013159b58d3724451befd AS runtime
|
||||
# Uses eclipse-temurin:21-jre-noble (Ubuntu 24.04), the Adoptium-supported JRE variant. The release
|
||||
# scan fails on a High or Critical finding that has a fix (2026-11-11 owner decision), and jammy
|
||||
# (22.04) carried seven OS findings with a fix (apt, openssl, libbrotli1, ...). When the scan
|
||||
# reports one again, the fix is a newer digest of this same tag.
|
||||
FROM eclipse-temurin:21-jre-noble@sha256:0eda5830ed7b669abc246a8dc520ea8a23cab06f9a8d4b6964109e2f2394e46f AS runtime
|
||||
|
||||
ARG BUILD_VERSION
|
||||
ARG GIT_SHA
|
||||
@@ -121,7 +125,7 @@ LABEL org.opencontainers.image.title="caskeleton" \
|
||||
RUN test -n "${BUILD_VERSION}" && test -n "${GIT_SHA}" && test -n "${SOURCE_URL}"
|
||||
|
||||
# ---- Locale / timezone (D4) -------------------------------------------------
|
||||
# C.UTF-8 is available in eclipse-temurin:21-jre-jammy without installing extra packages.
|
||||
# C.UTF-8 is available in eclipse-temurin:21-jre-noble without installing extra packages.
|
||||
# Do NOT use en_US.UTF-8 — it requires the locales package and may not exist in a slim image.
|
||||
ENV TZ=UTC \
|
||||
LANG=C.UTF-8 \
|
||||
@@ -157,7 +161,10 @@ ENV JAVA_TOOL_OPTIONS="\
|
||||
RUN mkdir -p /var/tmp/heap && chmod 1777 /var/tmp/heap
|
||||
|
||||
# ---- Non-root user (D3) -----------------------------------------------------
|
||||
RUN groupadd --system --gid 1000 app \
|
||||
# The noble base image ships a login user `ubuntu` with uid and gid 1000, which are the app user's.
|
||||
# It is removed first, so uid 1000 is this account and nothing else.
|
||||
RUN userdel --remove ubuntu \
|
||||
&& groupadd --system --gid 1000 app \
|
||||
&& useradd --system --uid 1000 --gid app --no-create-home --shell /usr/sbin/nologin app
|
||||
|
||||
# No data directory and no VOLUME. The image is the shipped composition, which keeps nothing on
|
||||
@@ -204,7 +211,7 @@ EXPOSE 8080 9001
|
||||
# Kubernetes ignores HEALTHCHECK and uses its own probes against the same path; this exists for
|
||||
# docker and Compose.
|
||||
#
|
||||
# wget is present in eclipse-temurin:21-jre-jammy, so nothing is installed for it.
|
||||
# wget is present in eclipse-temurin:21-jre-noble, so nothing is installed for it.
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
|
||||
CMD wget --no-verbose --tries=1 --spider \
|
||||
http://localhost:9001/actuator/health/readiness || exit 1
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
# bash scripts/ci/trivy-scan.sh filesystem dependency tree: block High/Critical, report
|
||||
# Medium/Low, fail on any CISA KEV match
|
||||
# bash scripts/ci/trivy-scan.sh image <reference> release image: write image-sbom.cdx.json,
|
||||
# block High/Critical, report Medium/Low
|
||||
# block High/Critical vulnerabilities and
|
||||
# forbidden application licenses, report the rest
|
||||
#
|
||||
# Tools are pinned release binaries with an asserted SHA-256, installed under RUNNER_TEMP (or a
|
||||
# temporary directory): a checksum is a supply-chain claim that can be checked offline, an action
|
||||
@@ -97,8 +98,18 @@ scan_filesystem() {
|
||||
scan_image() {
|
||||
trivy image --format cyclonedx --scanners license --output image-sbom.cdx.json "$1"
|
||||
test -s image-sbom.cdx.json
|
||||
trivy image --scanners vuln,license --severity CRITICAL,HIGH --exit-code 1 --ignorefile .trivyignore.yaml "$1"
|
||||
trivy image --scanners vuln,license --severity MEDIUM,LOW --exit-code 0 --ignorefile .trivyignore.yaml "$1"
|
||||
# Vulnerabilities, OS and application packages alike: High or Critical fails the release. A
|
||||
# finding with a fix is fixed (a newer base image digest or dependency); one with no fix yet is
|
||||
# carried in .trivyignore.yaml with its expiry (owner decision 2026-11-11).
|
||||
trivy image --scanners vuln --severity CRITICAL,HIGH --exit-code 1 --ignorefile .trivyignore.yaml "$1"
|
||||
trivy image --scanners vuln --severity MEDIUM,LOW --exit-code 0 --ignorefile .trivyignore.yaml "$1"
|
||||
# Licenses (same decision): an application dependency under a forbidden license (Trivy's
|
||||
# CRITICAL) fails the release. Every other license finding, the OS packages' included, is
|
||||
# reported and does not block: a distribution's GPL packages are not this application's terms.
|
||||
trivy image --scanners license --pkg-types library --severity CRITICAL --exit-code 1 \
|
||||
--ignorefile .trivyignore.yaml "$1"
|
||||
trivy image --scanners license --severity HIGH,MEDIUM,LOW,UNKNOWN --exit-code 0 \
|
||||
--ignorefile .trivyignore.yaml "$1"
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
|
||||
Reference in New Issue
Block a user