Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/pages/createGroup/pages/notion/CreateGroupNotionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ const CreateGroupNotionPage = () => {
RolePermissions.MEMBER_DELETE,
RolePermissions.ROLE_UPDATE,
RolePermissions.ROLE_GRANT,
RolePermissions.ROLE_REVOKE,
],
};
const member = {
name: "member",
permissions: [],
permissions: [RolePermissions.MEMBER_UPDATE],
};
Comment on lines +76 to 77

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

멤버 기본 권한을 MEMBER_UPDATE로 상향 — 권한 범위 재확인 권고

MEMBER_UPDATE의 범위가 “자기 자신 정보 수정”으로 제한돼 있는지 확인이 필요합니다. 타인 멤버 정보/역할까지 갱신 가능한 의미라면 기본 부여는 위험합니다. 서버는 주체 검증(userId === me)으로 강제하고, 프런트는 해당 권한으로 노출되는 UI(예: 멤버 편집 버튼)가 자기 자신일 때만 활성화되도록 가드가 필요합니다.

또한 멤버 기본 권한 변경은 다른 그룹 생성 플로우(노션 외 경로)에도 동일하게 반영되어야 합니다. 중복 정의를 방지하려면 공용 기본 권한 상수로 추출하는 것을 권장합니다.

적용 예(diff: 해당 구간에서 상수 사용으로 치환):

@@
-      const member = {
-        name: "member",
-        permissions: [RolePermissions.MEMBER_UPDATE],
-      };
+      const member = {
+        name: "member",
+        permissions: DEFAULT_MEMBER_PERMISSIONS,
+      };

상수 정의(파일 상단에 추가):

export const DEFAULT_MEMBER_PERMISSIONS: RolePermission[] = [
  RolePermissions.MEMBER_UPDATE,
];

검증 스크립트(멤버 업데이트 권한이 노출/행동 가드에 연결되는지 점검):


🏁 Script executed:

#!/bin/bash
# MEMBER_UPDATE 사용처와 가드 확인
rg -nP -C3 --type=ts 'MEMBER_UPDATE' src
# "본인만 편집" 제약이 구현되어 있는지 후보 패턴 검색
rg -nP -C2 --type=ts '(currentUser|me|isSelf).*MEMBER_UPDATE|MEMBER_UPDATE.*(currentUser|me|isSelf)' src

Length of output: 2556


멤버 기본 권한 MEMBER_UPDATE 부여 시 UI/서버 가드 미구현 확인 — 필수 수정 필요

rg 스크립트 결과,

  • CreateGroupNotionPage.tsx(76–77) 및 invitation 컴포넌트에서 RolePermissions.MEMBER_UPDATE 사용처는 확인되나
  • “본인만 편집” 제약을 위한 currentUser/me/isSelf 검사 로직이 전혀 구현되어 있지 않습니다.

해당 권한이 타인 정보·역할 변경까지 허용될 가능성이 있어 보안상 치명적이므로,

  1. 서버 측에서 userId === me 검증 로직이 반드시 적용되었는지 확인 및 보강
  2. 프런트엔드에서 MEMBER_UPDATE 권한 UI(예: 멤버 편집 버튼) 노출 시 본인 여부를 함께 체크하는 가드 추가

또한, 향후 다른 그룹 생성 플로우에서도 중복 정의를 방지하기 위해 기본 권한을 공용 상수로 추출할 것을 권장합니다.

— 수정 필요 위치

  • src/pages/createGroup/pages/notion/CreateGroupNotionPage.tsx (member 기본 권한 정의)
  • src/pages/manage/pages/members/sections/invitation/index.tsx (권한 검사 후 UI 노출 로직)
  • 서버 코드(userId===me 검증)
  • 공용 상수 정의: src/types/interfaces.ts 또는 별도 권한 설정 파일

— 예시 diff

@@ src/pages/createGroup/pages/notion/CreateGroupNotionPage.tsx
-      const member = {
-        name: "member",
-        permissions: [RolePermissions.MEMBER_UPDATE],
-      };
+      const member = {
+        name: "member",
+        permissions: DEFAULT_MEMBER_PERMISSIONS,
+      };
// src/types/interfaces.ts 또는 별도 권한 설정 파일
export const DEFAULT_MEMBER_PERMISSIONS: RolePermission[] = [
  RolePermissions.MEMBER_UPDATE,
];

— UI 가드 예시

{user.id === me.id && authorityChecker(userRole.permissions, ["MEMBER_UPDATE"]) && (
  <EditMemberButton />
)}

위 보안 이슈는 즉시 반영이 필요합니다.

🤖 Prompt for AI Agents
In src/pages/createGroup/pages/notion/CreateGroupNotionPage.tsx around lines
76-77, the default MEMBER_UPDATE permission is assigned without any self-checks;
add a shared constant for default member permissions (e.g., export
DEFAULT_MEMBER_PERMISSIONS in src/types/interfaces.ts or a new permissions file)
and replace the inline array with that constant; then update the frontend
components (notably
src/pages/manage/pages/members/sections/invitation/index.tsx) to only render
MEMBER_UPDATE UI controls when the current user is the same as the target user
(check me.id or currentUser.id === user.id) AND the authority check for
MEMBER_UPDATE passes; finally ensure server-side authorization enforces userId
=== me (or equivalent) before allowing MEMBER_UPDATE changes so the backend
rejects requests that attempt to modify other users regardless of client-side
guards.

try {
await createRole(groupUuid, manager.name, manager.permissions);
Expand Down