-
Notifications
You must be signed in to change notification settings - Fork 0
[Refactor] festival 도메인 분리 과정에서 발생한 버그 수정 및 예외 메시지 변경 #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- 메서드 명도 festival -> organization으로 변경
📝 WalkthroughWalkthrough이 PR은 애플리케이션 전반의 인가(authorization) 관련 에러 메시지를 표준화하는 변경입니다. 기존의 조직별로 구체적인 리소스 소유권 메시지(예: "해당 조직의 축제가 아닙니다", "해당 조직의 플레이스가 아닙니다")를 일관된 일반적 메시지 "접근 권한이 없습니다"로 통일합니다. 동시에 Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 상세 검토 의견긍정적 측면변경 사항이 매우 일관성 있게 구성되어 있습니다. 20개 이상의 파일에서 동일한 패턴을 따르고 있으며, 각 테스트 파일도 해당하는 서비스 파일과 함께 동기화되어 있어 일괄적 리팩토링의 추적성이 뛰어납니다. 식별된 한계점 및 고려사항1. 에러 메시지 표준화의 정보 손실 문제기존 메시지들이 사용자에게 더 명확한 컨텍스트를 제공했습니다. 예를 들어:
개선 제안:
2. PlaceJpaRepository 메서드 시그니처 변경의 영향 범위새 파라미터
3. validateTimeTagsBelongsToFestival → validateTimeTagsBelongsToOrganization 메서드 리네이밍이 변경이 의미론적으로 중요한 로직 변경을 반영합니다:
고려사항: 권장 확인 항목
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
Summary of ChangesHello @changuii, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 축제 관리 시스템의 보안과 일관성을 향상시키는 데 중점을 둡니다. 장소 복제 기능에서 발생할 수 있는 권한 문제를 해결하여, 오직 해당 조직에 속한 장소만이 복제될 수 있도록 보장합니다. 또한, 시스템 전반에 걸쳐 권한 관련 오류 메시지를 일반적인 '접근 권한이 없습니다.'로 통일하여 잠재적인 정보 노출을 방지하고 사용자에게 일관된 경험을 제공합니다. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request focuses on enhancing the security and clarity of the application by standardizing exception messages and refining the logic for place cloning. The primary change involves replacing specific, potentially revealing exception messages with a generic "접근 권한이 없습니다." (Access Denied) message to prevent external observers from gaining insights into the system's internal authorization mechanisms. Additionally, the place cloning functionality is improved to ensure that only places belonging to the same organization are cloned, addressing a bug where places from different organizations could be inadvertently cloned. The changes also include correcting parameter and method names related to Festival, which were incorrectly named as Organization.
src/main/java/com/daedan/festabook/announcement/service/AnnouncementService.java
Show resolved
Hide resolved
| private void validateTimeTagBelongsToOrganization(Long timeTagId, Long organizationId) { | ||
| if (!timeTagJpaRepository.existsByIdAndFestivalOrganizationId(timeTagId, organizationId)) { | ||
| throw new BusinessException("해당 조직의 시간 태그가 아닙니다.", HttpStatus.FORBIDDEN); | ||
| throw new BusinessException("접근 권한이 없습니다.", HttpStatus.FORBIDDEN); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The exception message is changed to a generic message to avoid exposing internal details. This enhances security by preventing attackers from gaining specific information about authorization failures. Severity: Medium
if (!timeTagJpaRepository.existsByIdAndFestivalOrganizationId(timeTagId, organizationId)) {
throw new BusinessException("접근 권한이 없습니다.", HttpStatus.FORBIDDEN);
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앞으로 이렇게 하기로 정했으니까 학습해
soeun2537
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ㅋㅋㅋ 고생하셨어요 ㅎㅎ 화이팅..
| "AND p.festival.id = :festivalId " + | ||
| "AND p.festival.organization.id = :organizationId") | ||
| List<Place> findAllByIdInAndFestivalId( | ||
| @Param("placeIds") Collection<Long> places, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 Collection으로 받는군요..
| @Query("SELECT p FROM Place p " + | ||
| "WHERE p.id IN (:placeIds) " + | ||
| "AND p.festival.id = :festivalId " + | ||
| "AND p.festival.organization.id = :organizationId") | ||
| List<Place> findAllByIdInAndFestivalId( | ||
| @Param("placeIds") Collection<Long> places, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요게 그때 festivalId -> organizationId로 변경해야 하는 것 때문에 수정하신건가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네 그때, organization에 포함되어있고, festival에도 포함되어 있는 Place를 조회해와야해요
- festival만 검증하면 organization에 속하지 않는 다른 festival을 제공했을 때 검증을 통과해요
#️⃣ 이슈 번호
#63
🛠️ 작업 내용
Summary by CodeRabbit
릴리스 노트
✏️ Tip: You can customize this high-level summary in your review settings.