From cfc80ae8d471956c1b4f943bf14378a07ebdab34 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Thu, 12 Nov 2026 01:18:24 +0900 Subject: [PATCH] =?UTF-8?q?build(release):=20=EA=B8=B0=EB=B3=B8=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=EB=A5=BC=20noble=EB=A1=9C=20?= =?UTF-8?q?=EC=98=AC=EB=A6=AC=EA=B3=A0=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20?= =?UTF-8?q?=EA=B2=80=EC=82=AC=EB=A5=BC=20=EC=B7=A8=EC=95=BD=EC=A0=90?= =?UTF-8?q?=EA=B3=BC=20=EB=9D=BC=EC=9D=B4=EC=84=A0=EC=8A=A4=EB=A1=9C=20?= =?UTF-8?q?=EB=82=98=EB=88=88=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: 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 이미지를 만든다). --- .github/dependency-vulnerability-policy.md | 9 +++++++++ Dockerfile | 21 ++++++++++++++------- scripts/ci/trivy-scan.sh | 17 ++++++++++++++--- 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/.github/dependency-vulnerability-policy.md b/.github/dependency-vulnerability-policy.md index 6b58f388..7063a1c5 100644 --- a/.github/dependency-vulnerability-policy.md +++ b/.github/dependency-vulnerability-policy.md @@ -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 처리 | 고칠 기한 | diff --git a/Dockerfile b/Dockerfile index 962163a7..5fc53fa5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/scripts/ci/trivy-scan.sh b/scripts/ci/trivy-scan.sh index 07d4ae31..e1f74bba 100755 --- a/scripts/ci/trivy-scan.sh +++ b/scripts/ci/trivy-scan.sh @@ -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 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