You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Fix] 영수증 이미지 object key 검증 강화 및 S3 객체 미존재 로그 추가 - #150
프론트엔드에서 영수증 이미지를 S3에 정상 업로드(PUT 200)한 뒤 영수증 분석 API를 호출하면 404 BILL_LOG-E019가 반환됩니다. S3에는 이미지가 정상 저장되어 있지만, 서버가 어떤 object key로 조회했는지 남지 않아 원인을 확정할 수 없습니다.
이 PR은 원인 추적을 위해 S3 객체 미존재 시 조회 key를 로그로 남기고, 발급된 적 없는 형식의 key가 404로 숨겨지지 않도록 영수증 이미지 object key 검증을 강화합니다.
POST /api/v1/meetings/{meetingId}/bill-log/receipt-analysis: 대소문자가 발급 형식과 다른 object key의 응답이 404 BILL_LOG-E019에서 400 BILL_LOG-E018로 바뀝니다. 서버가 발급한 key를 그대로 전달하는 정상 흐름에는 영향이 없습니다.
DB 및 설정 변경
없음
리뷰 시 참고 사항
이 PR은 원인을 확정하는 수정이 아니라 추적을 위한 수정입니다. dev 배포 후 프론트엔드에서 재현하면 S3 object not found 로그의 key와 S3 객체 목록을 비교해 원인을 확정할 수 있습니다.
object key에는 meetingId, userId, UUID만 포함되어 민감 정보에 해당하지 않는다고 판단했습니다.
체크리스트
변경 범위에 맞는 테스트를 실행했습니다.
계층 책임을 지키고 필요한 문서를 갱신했습니다.
비밀번호, 토큰, 개인정보 등 민감정보를 포함하지 않았습니다.
관련 없는 변경을 포함하지 않았습니다.
Summary by CodeRabbit
버그 수정
영수증 이미지 경로의 확장자와 파일 식별자가 발급 형식과 대소문자까지 정확히 일치하는지 확인합니다. 형식과 맞지 않는 경로는 허용되지 않습니다.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
The change tightens receipt image key validation and adds a diagnostic log for missing S3 objects. Keys issued by the server are unaffected. No actionable merge risk was identified.
Pre-merge checks | 4 | 1
❌ Failed checks (1 warning)
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files.
Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name
Status
Explanation
Title check
제목이 영수증 이미지 object key 검증 강화와 S3 객체 미존재 로그 추가라는 주요 변경 사항을 정확하고 간결하게 설명합니다.
Description check
개요, 작업 내용, 테스트 결과, API 변경, DB 및 설정 변경, 리뷰 참고 사항, 체크리스트를 모두 작성했습니다. 변경 목적과 영향도 구체적으로 설명합니다.
Linked Issues check
직접 연결된 활성 이슈 [#148]의 코딩 요구사항을 충족합니다. S3ObjectMetadataProvider는 S3 HEAD 응답이 404이면 objectKey와 requestId를 warn 로그에 기록한 뒤 기존 예외를 발생시킵니다. ReceiptImageObjectKey.create()는 확장자와 UUID가 발급 형식의 소문자 문자열과 …
Out of Scope Changes check
변경은 [#148]의 원인 추적과 잘못된 영수증 이미지 key 검증에 한정됩니다. S3 공통 컴포넌트의 404 로그 변경은 이슈가 명시한 공통 적용 범위와 일치합니다. ReceiptImageObjectKeyTest는 변경 동작을 검증하는 지원 테스트입니다. 확인된 변경에서 관련 없는 기능, 설정, DB 변경은 없습니다.
Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
Commit to this branch
Create a new PR
🧪 Generate unit tests (beta)
Commit to this branch
Create a new PR
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.
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
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.
개요
프론트엔드에서 영수증 이미지를 S3에 정상 업로드(PUT 200)한 뒤 영수증 분석 API를 호출하면
404 BILL_LOG-E019가 반환됩니다. S3에는 이미지가 정상 저장되어 있지만, 서버가 어떤 object key로 조회했는지 남지 않아 원인을 확정할 수 없습니다.이 PR은 원인 추적을 위해 S3 객체 미존재 시 조회 key를 로그로 남기고, 발급된 적 없는 형식의 key가 404로 숨겨지지 않도록 영수증 이미지 object key 검증을 강화합니다.
작업 내용
S3ObjectMetadataProvider에서 S3가 404를 반환하면objectKey와requestId를 warn 로그로 남깁니다. 공통 컴포넌트이므로 프로필, 그룹 커버, Post-log 사진 확인에도 동일하게 적용됩니다.ReceiptImageObjectKey.create()가 UUID와 확장자를 대소문자 구분 없이 허용하던 것을 발급 형식(소문자)과 정확히 일치할 때만 허용하도록 변경합니다..JPG나 대문자 UUID처럼 존재할 수 없는 key가 검증을 통과해404 BILL_LOG-E019로 응답했습니다.400 BILL_LOG-E018로 응답해 잘못된 key 전달을 바로 구분할 수 있습니다.테스트
ReceiptImageObjectKeyTest(신규): 발급 형식 key 허용, 대문자 확장자 거부, 대문자 UUID 거부API 변경
POST /api/v1/meetings/{meetingId}/bill-log/receipt-analysis: 대소문자가 발급 형식과 다른 object key의 응답이404 BILL_LOG-E019에서400 BILL_LOG-E018로 바뀝니다. 서버가 발급한 key를 그대로 전달하는 정상 흐름에는 영향이 없습니다.DB 및 설정 변경
리뷰 시 참고 사항
S3 object not found로그의 key와 S3 객체 목록을 비교해 원인을 확정할 수 있습니다.체크리스트
Summary by CodeRabbit