Skip to content

refactor: S3 업로드 URL 서명을 S3UploadUrlSigner 하나로 모은다 - #156

Merged
ff1451 merged 1 commit into
mainfrom
refactor/s3-presign-helper
Oct 18, 2026
Merged

ff1451 merged 1 commit into
mainfrom
refactor/s3-presign-helper

Conversation

@ff1451

@ff1451 ff1451 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

요약

동작을 바꾸지 않는 리팩토링. 관리자 이미지 라이브러리(AdminImageService)와 회원 사진(PhotoStorageService)이 S3 키 생성({접두어}/{UUID}.{확장자}), 공개 URL 조립, presigned PUT 서명 코드와 유효 시간 상수를 각자 갖고 있었다.

변경

  • global/storage/S3UploadUrlSigner.presignPut(keyPrefix, fileName, contentType, contentLength) → PresignedUpload(key, uploadUrl, publicUrl).
    • contentLength가 null이 아니면 크기도 서명한다(장부 증빙처럼 크기를 강제하는 경우). 회원 사진·라이브러리 이미지는 지금처럼 크기를 서명하지 않는다.
  • 두 서비스는 접두어만 넘긴다(member-photos/{memberId}, {purpose 소문자}). 서명은 네트워크 호출 없이 로컬에서 하므로 관리자 이미지의 "행 저장 → 서명" 순서를 "서명 → 행 저장"으로 바꿔도 차이가 없다.

하지 않은 것

회원 사진 업로드의 파일 형식·크기 제한(감사 SEC-1)은 동작 변경이라 이 PR에 넣지 않았다.

테스트

  • 실제 S3Presigner로 서명 결과(크기 서명 여부 등)를 검증하는 AdminImagePresignSignatureTest, 이미지·회원 사진 통합 테스트가 그대로 통과한다.
  • 로컬 전체 ./gradlew test: 549건 중 548 통과, 1 스킵.

관리자 이미지(AdminImageService)와 회원 사진(PhotoStorageService)이 키 생성·공개 URL 조립·
presigned PUT 서명 코드를 각자 갖고 있었다.

- global/storage/S3UploadUrlSigner.presignPut(키 접두어, 파일명, 콘텐츠 타입, 크기)로 모은다.
- 키 형식({접두어}/{UUID}.{확장자}), 유효 시간(10분), 크기 서명 여부는 그대로다.
@coderabbitai

coderabbitai Bot commented Oct 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 57 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b301cff7-823e-4284-833d-46871d96d7ab
📥 Commits

Reviewing files that changed from the base of the PR and between be02c09 and a5e5b88.

📒 Files selected for processing: 4
  • src/main/java/com/bcsdlab/bcsdinternalapiv2/global/storage/S3UploadUrlSigner.java
  • src/main/java/com/bcsdlab/bcsdinternalapiv2/media/service/AdminImageService.java
  • src/main/java/com/bcsdlab/bcsdinternalapiv2/member/service/PhotoStorageService.java
  • src/test/java/com/bcsdlab/bcsdinternalapiv2/media/AdminImagePresignSignatureTest.java
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

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

@ff1451
ff1451 merged commit ec9467b into main Oct 18, 2026
2 checks passed
@ff1451
ff1451 deleted the refactor/s3-presign-helper branch October 18, 2026 13:51
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.

1 participant