[FIX} 주인이 아닌 스탬프 삭제 권한 이슈 해결 - #533 #534
Merged
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.
Related issue 🛠
Work Description ✏️
지난 pr에서 주인이 아닌 스탬프 삭제 권한을 검증하기 위해 SoptampFacade 내부에서 stamp.getUserId().equals(userId)로 소유자 검증하도록 수정했지만 여전히 소유자가 아님에도 삭제가 가능한 이슈를 발견했습니다.
기존 코드는 stampService.getStampById()는 userId 없이 stampId만으로 접근 가능해, 구조적으로도 보안에 취약한 부분이 있다고 판단해서 이번 수정에서는 stamp 조회 시점에서부터 userId를 명시적으로 요구하는 getStampForDelete() 메서드를 분리하여
소유자 검증이 누락되거나 우회되는 문제를 구조적으로 차단하였습니다.
권한 체크가 적용된 메서드 추가 및 사용
2787076
856890a
테스트 코드 수정
ef7fa8e
Trouble Shooting ⚽️
Related ScreenShot 📷
Uncompleted Tasks 😅
To Reviewers 📢