Skip to content

Conversation

@hyh1016
Copy link
Collaborator

@hyh1016 hyh1016 commented Aug 8, 2025

📌 관련 이슈

#59

📝 작업 개요

이럴 수가.. slack webhook url에 포함된 '/' 문자열과 sed의 구분자가 충돌해서 cd script가 터졌습니다.

✅ 작업 사항

slack webhook 시크릿 변수의 sed 구분자만 /에서 |로 조치

💭 고민한 점들

일단 임시조치고, sed 사용하는 것 자체를 바꿔야 할듯

Summary by CodeRabbit

  • Chores
    • 배포 워크플로우에서 환경 변수 치환 명령어의 구분자를 변경하여 처리 방식을 개선했습니다.

@hyh1016 hyh1016 requested a review from pythonstrup August 8, 2025 14:08
@hyh1016 hyh1016 self-assigned this Aug 8, 2025
@hyh1016 hyh1016 added the bug Something isn't working label Aug 8, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 8, 2025

Walkthrough

sed 명령어에서 대체 구분자를 슬래시(/)에서 파이프(|)로 변경하는 수정이 .github/workflows/cd.yml 파일에 적용되었습니다. 이 변경은 단순히 명령어 구문에만 영향을 주며, 실제 동작이나 치환 내용에는 변화가 없습니다.

Changes

Cohort / File(s) Change Summary
CI/CD 워크플로우 스크립트
.github/workflows/cd.yml
sed 명령어의 구분자를 /에서 `

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

파이프를 들고 슬래시를 내려놓았네,
sed는 여전히 부지런히 일하네.
작은 변화, 큰 소동은 없고,
토끼는 흐뭇하게 귀를 쫑긋 세웠네.
CI/CD 흐름 속, 평화로운 봄날 같아! 🐇

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/59

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
.github/workflows/cd.yml (1)

25-33: 중요: 비밀값을 빌드 산출물(이미지)에 내장하는 방식은 보안 리스크가 큼

현재 sed로 src/main/resources/application.yml을 수정한 뒤 빌드하므로, 비밀값이 JAR/이미지에 영구 포함됩니다. 레지스트리·운영 서버 노출 리스크가 큽니다. 빌드 산출물에 비밀을 넣지 말고, 컨테이너 실행 시 환경변수로 주입하는 방식으로 전환을 강력히 권장합니다.

제안 diff:

  • sed 치환 스텝 제거
  • docker run에 환경변수로 안전 주입
@@
-      - name: Replace placeholders with secrets
-        run: |
-          sed -i 's/${JWT_SECRET:[^}]*}/${{ secrets.JWT_SECRET }}/g' src/main/resources/application.yml
-          sed -i 's/${DB_HOST:[^}]*}/${{ secrets.DB_HOST }}/g' src/main/resources/application.yml
-          sed -i 's/${DB_USERNAME:[^}]*}/${{ secrets.DB_USERNAME }}/g' src/main/resources/application.yml
-          sed -i 's/${DB_PASSWORD:[^}]*}/${{ secrets.DB_PASSWORD }}/g' src/main/resources/application.yml
-          sed -i 's/${GEMINI_API_KEY:[^}]*}/${{ secrets.GEMINI_API_KEY }}/g' src/main/resources/application.yml
-          sed -i 's|${SLACK_WEBHOOK_URL:[^}]*}|${{ secrets.SLACK_WEBHOOK_URL }}|g' src/main/resources/application.yml
+      # NOTE: build 시 비밀값을 주입하지 않습니다. (이미지 내장 금지)
@@
-            docker run -d \
+            docker run -d \
               --name $CONTAINER_NAME \
               --network $NETWORK_NAME \
               -p 8080:8080 \
+              -e JWT_SECRET='${{ secrets.JWT_SECRET }}' \
+              -e DB_HOST='${{ secrets.DB_HOST }}' \
+              -e DB_USERNAME='${{ secrets.DB_USERNAME }}' \
+              -e DB_PASSWORD='${{ secrets.DB_PASSWORD }}' \
+              -e GEMINI_API_KEY='${{ secrets.GEMINI_API_KEY }}' \
+              -e SLACK_WEBHOOK_URL='${{ secrets.SLACK_WEBHOOK_URL }}' \
               ${{ secrets.REGISTRY_URL }}/${{ secrets.IMAGE_NAME }}:${{ github.sha }}

장점:

  • 비밀값이 소스/산출물에 남지 않음
  • 롤오버/교체 시 재빌드 없이 재배포만으로 적용 가능

Also applies to: 87-91

🧹 Nitpick comments (3)
.github/workflows/cd.yml (3)

25-33: 실패 조기 감지: set -euo pipefail 및 치환 검증 추가 권장

치환 실패해도 sed는 0을 반환할 수 있습니다. 스텝 상단에 엄격 모드와 검증을 추가해 조기 실패하도록 해주세요.

다음과 같이 보완 가능합니다:

-      - name: Replace placeholders with secrets
-        run: |
+      - name: Replace placeholders with secrets
+        run: |
+          set -euo pipefail
           sed -i 's|${SLACK_WEBHOOK_URL:[^}]*}|${{ secrets.SLACK_WEBHOOK_URL }}|g' src/main/resources/application.yml
+          # 치환 검증: placeholder 남아있으면 실패
+          if grep -q '${SLACK_WEBHOOK_URL:' src/main/resources/application.yml; then
+            echo "SLACK_WEBHOOK_URL placeholder replacement failed" >&2
+            exit 1
+          fi

(다른 변수들도 동일한 검증 추가 권장)


79-79: docker login 보안 강화: --password-stdin 사용 권장

명령행 인자 -p는 프로세스 리스트 노출 위험이 있습니다. --password-stdin으로 전환하세요.

-            docker login -u ${{ secrets.REGISTRY_USERNAME }} -p ${{ secrets.REGISTRY_PASSWORD }} ${{ secrets.REGISTRY_URL }}
+            echo '${{ secrets.REGISTRY_PASSWORD }}' | docker login -u '${{ secrets.REGISTRY_USERNAME }}' --password-stdin '${{ secrets.REGISTRY_URL }}'

69-69: 서드파티 액션 버전 고정 권장 (supply chain 리스크 감소)

appleboy/ssh-action@master 대신 태그 혹은 커밋 SHA로 핀닝하세요. 재현성과 공급망 보안을 개선합니다.

예: appleboy/[email protected] 또는 특정 커밋 SHA (팀 표준에 맞춰 선택).

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e386975 and 5569525.

📒 Files selected for processing (1)
  • .github/workflows/cd.yml (1 hunks)
🔇 Additional comments (2)
.github/workflows/cd.yml (2)

32-32: 슬래시 충돌을 피하기 위한 파이프 구분자 변경 — 적절한 핫픽스입니다

Slack Webhook URL 내 /로 인한 sed 실패를 깔끔하게 해소합니다. 현재 맥락에선 안정적으로 동작할 것으로 보입니다.


27-31: sed 구분자 통일 적용 검토 요청

현재 .github/workflows/cd.yml의 sed 치환식에서 /를 구분자로 사용하고 있어, 대체값(시크릿)에 슬래시(/)가 포함될 경우 치환이 실패할 수 있습니다. 아래 사항을 검토 후 필요 시 변경을 적용해주세요.

  • 대상 파일: .github/workflows/cd.yml
  • 대상 라인: 27–31
  • 권장 변경 예시:
    -          sed -i 's/${JWT_SECRET:[^}]*}/${{ secrets.JWT_SECRET }}/g' src/main/resources/application.yml
    -          sed -i 's/${DB_HOST:[^}]*}/${{ secrets.DB_HOST }}/g' src/main/resources/application.yml
    -          sed -i 's/${DB_USERNAME:[^}]*}/${{ secrets.DB_USERNAME }}/g' src/main/resources/application.yml
    -          sed -i 's/${DB_PASSWORD:[^}]*}/${{ secrets.DB_PASSWORD }}/g' src/main/resources/application.yml
    -          sed -i 's/${GEMINI_API_KEY:[^}]*}/${{ secrets.GEMINI_API_KEY }}/g' src/main/resources/application.yml
    +          sed -i 's|${JWT_SECRET:[^}]*}|${{ secrets.JWT_SECRET }}|g' src/main/resources/application.yml
    +          sed -i 's|${DB_HOST:[^}]*}|${{ secrets.DB_HOST }}|g' src/main/resources/application.yml
    +          sed -i 's|${DB_USERNAME:[^}]*}|${{ secrets.DB_USERNAME }}|g' src/main/resources/application.yml
    +          sed -i 's|${DB_PASSWORD:[^}]*}|${{ secrets.DB_PASSWORD }}|g' src/main/resources/application.yml
    +          sed -i 's|${GEMINI_API_KEY:[^}]*}|${{ secrets.GEMINI_API_KEY }}|g' src/main/resources/application.yml

※ 시크릿 값에 & 또는 \가 포함될 경우에도 sed 치환이 실패할 수 있으니, 장기적으로는 envsubst 사용 또는 런타임 환경 변수 주입 방식 전환을 검토 바랍니다.
※ 실제 시크릿 값에 슬래시(/)가 포함되는지 확인해 주세요.

@hyh1016 hyh1016 merged commit 40ad1d9 into main Aug 8, 2025
3 checks passed
@hyh1016 hyh1016 deleted the feature/59 branch September 24, 2025 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants