Skip to content

Conversation

@hyerinhwang-sailin
Copy link
Collaborator

@hyerinhwang-sailin hyerinhwang-sailin commented Apr 10, 2025

Related issue 🛠

Work Description ✏️

지난 pr에서 주인이 아닌 스탬프 삭제 권한을 검증하기 위해 SoptampFacade 내부에서 stamp.getUserId().equals(userId)로 소유자 검증하도록 수정했지만 여전히 소유자가 아님에도 삭제가 가능한 이슈를 발견했습니다.
기존 코드는 stampService.getStampById()는 userId 없이 stampId만으로 접근 가능해, 구조적으로도 보안에 취약한 부분이 있다고 판단해서 이번 수정에서는 stamp 조회 시점에서부터 userId를 명시적으로 요구하는 getStampForDelete() 메서드를 분리하여
소유자 검증이 누락되거나 우회되는 문제를 구조적으로 차단하였습니다.

  • 권한 체크가 적용된 메서드 추가 및 사용

    • StampService#getStampForDelete(Long stampId, Long userId) 추가
      • 본인 소유 스탬프인지 확인하고, 아니라면 ForbiddenException 발생
        2787076
    • SoptampFacade#deleteStamp() 에서 기존 getStampById() → getStampForDelete() 로 변경
      856890a
  • 테스트 코드 수정

    • SoptampFacadeTest#SUCCESS_deleteStamp() 에서 getStampById() 를 getStampForDelete() 호출 시나리오로 변경
      ef7fa8e

Trouble Shooting ⚽️

Related ScreenShot 📷

Uncompleted Tasks 😅

To Reviewers 📢

@hyerinhwang-sailin hyerinhwang-sailin linked an issue Apr 10, 2025 that may be closed by this pull request
1 task
@height
Copy link

height bot commented Apr 10, 2025

Link Height tasks by mentioning a task ID in the pull request title or commit messages, or description and comments with the keyword link (e.g. "Link T-123").

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

@hyerinhwang-sailin hyerinhwang-sailin self-assigned this Apr 10, 2025
@hyerinhwang-sailin hyerinhwang-sailin merged commit 64433f7 into dev Apr 10, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] 주인이 아닌 스탬프 삭제 권한 이슈

1 participant