Skip to content

[CHORE] CI 공급망을 굳힌다 — 액션 SHA 고정 · Dependabot · zizmor · Trivy - #374

Merged
mosungjin merged 1 commit into
security/tenant-authz-semgrep-rulesfrom
security/ci-supply-chain
Aug 12, 2026
Merged

[CHORE] CI 공급망을 굳힌다 — 액션 SHA 고정 · Dependabot · zizmor · Trivy#374
mosungjin merged 1 commit into
security/tenant-authz-semgrep-rulesfrom
security/ci-supply-chain

Conversation

@Yoonjongho1122

@Yoonjongho1122 Yoonjongho1122 commented Aug 11, 2026

Copy link
Copy Markdown
Member

⚠️ #371 위에 쌓은 PR입니다. base 가 security/tenant-authz-semgrep-rules 라 diff 에 이 PR 변경만 보입니다. #371 이 머지되면 GitHub 가 base 를 develop 으로 자동 재지정합니다.

📌 연관 이슈

  • API 변경 없음 (CI 설정만)

📝 작업 내용

러너는 PR 코드를 컴파일·실행합니다. 액션이 태그로 참조되면 그 태그는 언제든 다른 커밋을 가리킬 수 있고, 그때 러너의 토큰과 시크릿이 함께 나갑니다.

1) 액션 25개를 전부 full-length SHA 로 고정

후행 태그 주석(# v4)을 남겼습니다 — Dependabot 이 그 주석을 읽고 SHA 와 주석을 함께 올려줍니다. 주석을 지우면 그 액션은 갱신이 멈추고 낡은 버전에 영구히 묶이니 지우지 마세요.

gate1-semgrep.yml 의 semgrep container 이미지는 태그를 유지했습니다. Dependabot 이 워크플로 container 는 갱신해주지 않아 digest 로 박으면 손으로 계속 올려야 한다는 기존 주석의 판단을 그대로 둡니다.

2) .github/dependabot.yml — gradle · github-actions 주간. 리포터.

3) zizmor 를 Gate 1 에 추가 (차단)

워크플로 파일 자체의 보안을 봅니다. 도입 전 4건이 나왔는데 전부 팀이 이미 다른 워크플로에서 지키던 규약과 어긋난 지점이라 고쳤습니다.

건수 내용
artipacked 3 checkout 에 persist-credentials: false 누락 (backend-ci 3 · cd 1)
excessive-permissions 1 gate1-semgreppermissions 선언 없음 → contents: read 추가

지금 findings 0 입니다. baseline 부채가 없어 유예할 것이 없으므로 차단으로 켭니다.

4) Trivy 2개 — 둘 다 리포터로 시작

  • image: develop push 에서 밀기 전에 스캔합니다. 순서가 핵심입니다 — 밀고 나서 스캔하면 취약한 이미지가 이미 레지스트리에 있고, 그걸 당기는 쪽은 결과를 모릅니다. Dockerfileffmpeg 를 설치하고 그게 회의 녹음을 파싱하므로 OS 패키지 CVE 표면이 실재합니다.
  • config: PR 에서 Dockerfile·compose 설정만 봅니다. 빌드가 없어 몇 초입니다.

💡 백엔드 리뷰 포인트

왜 Trivy 는 리포터로 시작하나

findings 를 아직 본 적이 없습니다. 차단으로 켜면 develop 배포나 모든 PR 이 첫날 멈출 수 있습니다. 첫 실행 결과를 보고 exit-code 를 1 로 올립니다 — 워크플로 주석에 "올릴 때 이 주석도 함께 지울 것"이라고 적어뒀습니다(정책과 코드가 어긋난 채 남지 않게).

zizmor 는 반대로 처음부터 차단입니다. 결정론 도구고 도입 시점 findings 가 0 이라 유예할 부채가 없습니다.

이미지를 두 번 빌드하는 것처럼 보이는 부분

load: true 로 먼저 받아 스캔하고, 그 다음 push 합니다. 두 번째 빌드는 첫 번째의 GHA 캐시를 그대로 써서 실질 비용은 거의 없습니다.

우려되는 부분

  1. Gradle Test 가 불안정합니다 — 이 PR 과 무관하게 develop 에서도 Java heap space / OutOfMemoryError 로 실패합니다(run 31485537291). gradle.properties 가 없고 maxHeapSize 설정도 없어 기본 힙으로 돕니다. 이게 고쳐지지 않으면 Gradle Test 를 required check 로 못 묶습니다 — 별도 처리 필요.
  2. Dependabot 이 처음 켜지면 PR 이 여러 개 열릴 수 있습니다(limit 5 로 제한).

✅ 체크리스트

  • 워크플로 5개 YAML 파싱 확인
  • zizmor findings 0 확인
  • 태그 참조 잔여 0 확인
  • 모든 SHA 를 GitHub API 로 태그에서 직접 확인

🤖 Generated with Claude Code

Summary by CodeRabbit

  • 보안 강화
    • CI/CD 과정에서 사용하는 외부 도구를 안전하게 검증하고, Docker 이미지와 설정 파일의 주요 취약점을 자동 검사합니다.
    • 워크플로 권한을 최소화하고 보안 설정 오류를 점검합니다.
  • 자동화
    • Gradle 및 GitHub Actions 의존성을 매주 확인하고 업데이트 제안이 자동으로 생성됩니다.
    • 빌드·테스트·배포 과정의 안정성과 추적 가능성이 향상되었습니다.

러너는 PR 코드를 컴파일·실행한다. 액션이 태그로 참조되면 그 태그는 언제든 다른
커밋을 가리킬 수 있고, 그때 러너의 토큰과 시크릿이 함께 나간다.

1) 액션 25개를 전부 full-length SHA 로 고정. 후행 태그 주석(# v4)을 남긴다 —
   Dependabot 이 그 주석을 읽고 SHA 와 주석을 함께 올려준다. 주석을 지우면 그
   액션은 갱신이 멈추므로 지우지 말 것.
   (gate1 의 semgrep container 이미지는 태그 유지 — Dependabot 이 워크플로 container
    를 갱신해주지 않아 digest 로 박으면 낡은 엔진에 영구히 묶인다. 기존 판단 유지.)

2) .github/dependabot.yml — gradle · github-actions 주간. 리포터.

3) zizmor 를 Gate 1 에 추가(차단). 워크플로 파일 자체의 보안을 본다.
   도입 전 4건이 나왔고 전부 팀이 이미 지키던 규약과 어긋난 지점이라 고쳤다.
   - artipacked 3건 : checkout 에 persist-credentials: false 누락 (backend-ci 3 · cd 1)
   - excessive-permissions 1건 : gate1-semgrep 에 permissions 선언 없음 → contents: read
   지금 findings 0 이다. baseline 부채가 없어 유예할 것이 없으므로 차단으로 켠다.

4) Trivy 2개 — 둘 다 리포터로 시작한다.
   - image  : develop push 에서 밀기 전에 스캔한다. 밀고 나서 스캔하면 취약한 이미지가
              이미 레지스트리에 있다. Dockerfile 이 ffmpeg 를 설치하고 그게 회의 녹음을
              파싱하므로 OS 패키지 CVE 표면이 실재한다.
   - config : PR 에서 Dockerfile·compose 설정만 본다. 빌드가 없어 몇 초면 끝난다.
   findings 를 아직 본 적이 없어 차단으로 켜면 첫날 배포·PR 이 멈출 수 있다.
   첫 실행 결과를 보고 exit-code 를 올린다.

검증: 워크플로 5개 YAML 파싱 OK · zizmor findings 0 · 태그 참조 잔여 0.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Dependabot 업데이트 정책을 추가했다. CI/CD 워크플로의 외부 액션을 커밋 SHA로 고정했다. Docker 이미지와 설정을 Trivy로 검사하고, 워크플로 자체를 zizmor로 검사하도록 구성했다.

Changes

CI/CD 보안 및 의존성 자동화

Layer / File(s) Summary
Dependabot 업데이트 설정
.github/dependabot.yml
Gradle과 GitHub Actions를 매주 월요일 서울 시간 09:00에 검사한다. 열린 PR 수를 5개로 제한하고 커밋 접두사와 라벨을 설정한다.
백엔드 CI 이미지 및 설정 검사
.github/workflows/backend-ci.yml
Checkout, Java, Buildx, Docker 로그인 및 빌드 액션을 커밋 SHA로 고정한다. Docker 이미지와 Dockerfile·compose 설정을 Trivy로 검사한다.
배포 워크플로 액션 고정
.github/workflows/cd.yml
Checkout, Buildx, Docker 로그인, 이미지 빌드·푸시 및 AWS 인증 액션을 커밋 SHA로 고정한다. Checkout 자격증명 보존을 비활성화한다.
워크플로 보안 게이트 및 액션 고정
.github/workflows/gate1-semgrep.yml, .github/workflows/gate2-judge.yml
워크플로 권한을 contents: read로 제한한다. zizmor 보안 검사를 추가하고 관련 외부 액션을 커밋 SHA로 고정한다.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • Z-Groupware/BACKEND#23: .github/workflows/cd.yml의 Docker 및 GitHub Actions 배포 설정을 함께 변경했다.

Suggested reviewers: dlxodus02, mosungjin

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 액션 SHA 고정, Dependabot, zizmor, Trivy를 포함한 CI 공급망 보안 강화라는 주요 변경 사항을 정확히 요약한다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch security/ci-supply-chain

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/backend-ci.yml:
- Around line 49-52: Remove the duplicate with mapping in the workflow step,
keeping a single with block containing persist-credentials: false and preserving
the existing comment or intended context.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fc990a5c-f6ec-47a1-bc34-e500cc2361bc

📥 Commits

Reviewing files that changed from the base of the PR and between 84c5c9c and 42cc4f9.

📒 Files selected for processing (5)
  • .github/dependabot.yml
  • .github/workflows/backend-ci.yml
  • .github/workflows/cd.yml
  • .github/workflows/gate1-semgrep.yml
  • .github/workflows/gate2-judge.yml

Comment on lines +49 to 52
with:
persist-credentials: false # 러너에 git 자격증명을 남기지 않는다
with:
persist-credentials: false # PR 코드를 컴파일·실행하는 잡 — 러너에 git 자격증명을 남기지 않는다

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

중복된 with 키를 제거하십시오.

Line 51은 Line 49의 with 키를 중복 정의합니다. 이 매핑은 actionlint 및 YAMLlint 검증에서 오류입니다. 하나의 with 블록만 유지하십시오.

수정 예시
         with:
           persist-credentials: false   # 러너에 git 자격증명을 남기지 않는다
-        with:
-          persist-credentials: false   # PR 코드를 컴파일·실행하는 잡 — 러너에 git 자격증명을 남기지 않는다
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
with:
persist-credentials: false # 러너에 git 자격증명을 남기지 않는다
with:
persist-credentials: false # PR 코드를 컴파일·실행하는 잡 — 러너에 git 자격증명을 남기지 않는다
with:
persist-credentials: false # 러너에 git 자격증명을 남기지 않는다
🧰 Tools
🪛 actionlint (1.7.12)

[error] 51-51: key "with" is duplicated in element of "steps" section. previously defined at line:49,col:9

(syntax-check)

🪛 YAMLlint (1.37.1)

[error] 51-51: duplication of key "with" in mapping

(key-duplicates)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/backend-ci.yml around lines 49 - 52, Remove the duplicate
with mapping in the workflow step, keeping a single with block containing
persist-credentials: false and preserving the existing comment or intended
context.

Source: Linters/SAST tools

@mosungjin mosungjin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인했습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants