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