Skip to content

Security/member access and file ownership - #65

Open
wonjongin wants to merge 2 commits into
mainfrom
security/member-access-and-file-ownership
Open

Security/member access and file ownership#65
wonjongin wants to merge 2 commits into
mainfrom
security/member-access-and-file-ownership

Conversation

@wonjongin

Copy link
Copy Markdown

#️⃣ 연관된 이슈

📝 작업 내용

  • 회원 정보 번호 조회(GET /api/v1/members/{memberId})를 본인 번호로만 조회 가능하도록 제한했습니다. 타인의 학번·전화번호·이메일 등 개인정보가 노출되던 문제를 방지하고, 본인이 아닌 회원 조회 시 403을 반환합니다.
  • 파일 삭제(DELETE /api/v1/files) 권한을 관리자(ADMIN)로 제한했습니다. 파일 소유권 검증 없이 S3 key만 알면 누구나 파일을 삭제할 수 있던 문제를 방지합니다.

📢 참고 사항

  • 파일 삭제는 현재 소유권을 저장하는 DB가 없어 우선 ADMIN 전용으로 제한했습니다. 집행부/회장도 삭제가 필요하거나, 일반 회원이 본인 업로드 파일을 직접 삭제하는 UX가 필요하면 업로드 key에 사용자 prefix를 강제하거나 소유권 테이블을 두는 방식으로 후속 작업이 필요합니다.

wonjongin and others added 2 commits July 10, 2026 17:53
타인의 학번·전화번호·이메일 등 개인정보 노출 방지를 위해
GET /members/{memberId} 조회를 본인 번호로만 제한하고, 불일치 시 403 반환

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
파일 소유권 검증 없이 key만 알면 임의 삭제가 가능하던 문제를 방지하기 위해
DELETE /files 권한을 ADMIN으로 제한

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment on lines +45 to +46
// 파일 삭제 (임의 삭제 방지를 위해 관리자만 허용)
@PreAuthorize("hasRole('ADMIN')")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

게시물 삭제, 파일 목록에서 파일 삭제 권한(COUNCIL, PRESIDENT, ADMIN)과 동일하게 맞추어야 COUNCIL, PRESIDENT 권한 유저가 게시물을 삭제했을 때 오류가 안 뜰 것 같아요

})
ResponseEntity<SuccessResponse<?>> getOtherMemberInfo(@PathVariable("memberId") Long memberId);
ResponseEntity<SuccessResponse<?>> getOtherMemberInfo(Long authMemberId,
@PathVariable("memberId") Long memberId);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 api는 아예 제거해도 될 것 같아요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] 보안 취약점 개선 및 인가 로직 고도화

2 participants