Repository navigation
refactor: S3 업로드 URL 서명을 S3UploadUrlSigner 하나로 모은다 - #156
Merged
Merged
Conversation
관리자 이미지(AdminImageService)와 회원 사진(PhotoStorageService)이 키 생성·공개 URL 조립·
presigned PUT 서명 코드를 각자 갖고 있었다.
- global/storage/S3UploadUrlSigner.presignPut(키 접두어, 파일명, 콘텐츠 타입, 크기)로 모은다.
- 키 형식({접두어}/{UUID}.{확장자}), 유효 시간(10분), 크기 서명 여부는 그대로다.
|
Warning Review limit reachedYou'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. View limit details
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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
요약
동작을 바꾸지 않는 리팩토링. 관리자 이미지 라이브러리(
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 스킵.