Skip to content

fix(workflow): secret을 env 블록으로 격리 (#22) - #24

Merged
jaeyeonling merged 1 commit into
mainfrom
fix/22-secret-env-isolation
Apr 30, 2026
Merged

fix(workflow): secret을 env 블록으로 격리 (#22)#24
jaeyeonling merged 1 commit into
mainfrom
fix/22-secret-env-isolation

Conversation

@jaeyeonling

Copy link
Copy Markdown
Contributor

Summary

  • deploy.yml의 Upload to S3, Deploy to CodeDeploy step에서 ${{ secrets.X }}run: 명령에 직접 인터폴레이션하던 것을 env: 블록으로 격리
  • shell 변수 참조 시 double-quote로 감싸 word splitting 방지

변경 사항

Before After
s3://${{ secrets.S3_BUCKET_NAME }}/... env: S3_BUCKET_NAME"s3://${S3_BUCKET_NAME}/..."
--application-name ${{ secrets.APPLICATION_NAME }} env: APPLICATION_NAME"${APPLICATION_NAME}"

왜 필요한가

GitHub Actions expression은 YAML 파싱 시점에 문자열 치환됩니다. secret 값에 셸 메타문자가 포함되면 명령 분리/경로 조작이 가능합니다. env: 블록으로 전달하면 셸 환경변수로 안전하게 격리됩니다.

참고: GitHub Blog — How to catch workflow injections

Test plan

  • tag push로 deploy workflow 트리거 시 S3 업로드, CodeDeploy 배포 정상 동작 확인
  • secret 값에 특수문자 없는 현재 설정에서 동작 변화 없음 확인

Closes #22

…l interpolation (#22)

Secrets injected directly into run: commands via ${{ secrets.X }} are expanded
at YAML parse time, making them vulnerable to shell metacharacter injection
if a secret value ever contains $, ;, backticks, etc.

Move S3_BUCKET_NAME, APPLICATION_NAME, and DEPLOYMENT_GROUP_NAME into per-step
env: blocks and reference them as quoted shell variables ("${VAR}").
@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@jaeyeonling
jaeyeonling merged commit 0a31d25 into main Apr 30, 2026
1 check passed
@jaeyeonling
jaeyeonling deleted the fix/22-secret-env-isolation branch April 30, 2026 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(workflow): secret을 shell 명령에 직접 인터폴레이션 — env로 격리

1 participant