From 726e295f76b85fc5a13d5c9083ce500522c7a849 Mon Sep 17 00:00:00 2001 From: happybell80 Date: Fri, 15 Aug 2025 12:51:28 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=9D=B8?= =?UTF-8?q?=EC=A6=9D=20=EC=8B=9C=EC=8A=A4=ED=85=9C=20=EB=B3=B4=EC=95=88=20?= =?UTF-8?q?=EA=B0=9C=EC=84=A0=20=EB=AC=B8=EC=84=9C=20=EC=97=85=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Frontend 코드 구체적인 수정 사항 추가 - robing-gateway 설정 관리 문제 추가 - 서버별 현황 상세화 --- ..._시스템_보안_개선_필요사항.md | 79 ++++++++++++++++--- 1 file changed, 69 insertions(+), 10 deletions(-) diff --git a/ideas/250815_로그인_인증_시스템_보안_개선_필요사항.md b/ideas/250815_로그인_인증_시스템_보안_개선_필요사항.md index 9a21dce..8703bef 100644 --- a/ideas/250815_로그인_인증_시스템_보안_개선_필요사항.md +++ b/ideas/250815_로그인_인증_시스템_보안_개선_필요사항.md @@ -60,15 +60,61 @@ ## 긴급 수정 필요사항 ### Frontend 수정 -```javascript -// API 클라이언트에 토큰 헤더 추가 -const apiCall = async (endpoint, data) => { - const token = localStorage.getItem('auth_token'); - const headers = { - 'Content-Type': 'application/json', - 'Authorization': token ? `Bearer ${token}` : '' // 추가! + +### robing-api.ts 수정 필요 +```typescript +// 현재 문제: 토큰 전송 안 함, 하드코딩된 userId +export async function sendMessage(text: string, userId: string = 'test_user'): Promise { + const response = await fetch(`${ROBING_API_URL}/api/chat`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'X-User-Id': userId // ❌ 토큰 없음, 조작 가능 + }, + body: JSON.stringify({ + message: text, + user_id: userId + }) + }); +} + +// 수정 필요 +export async function sendMessage(text: string, token: string, userId: string): Promise { + const response = await fetch(`${ROBING_API_URL}/api/chat`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${token}`, // ✅ JWT 토큰 추가 + 'X-User-Id': userId // 호환성 유지 (임시) + }, + body: JSON.stringify({ + message: text, + user_id: userId + }) + }); +} +``` + +### chat-interface.tsx 수정 필요 +```typescript +// 현재: useAuth 사용 안 함 +import { sendMessage } from '@/services/robing-api'; + +// 수정 필요 +import { useAuth } from '@/contexts/auth-context'; + +const ChatInterface = () => { + const { user, isAuthenticated } = useAuth(); + + const handleSend = async (input: string) => { + if (!isAuthenticated || !user) { + // 로그인 유도 + return; + } + + const token = localStorage.getItem('auth_token'); + const response = await sendMessage(input, token, user.id); }; - // ... }; ``` @@ -149,21 +195,34 @@ payload = { } ``` -## 서버별 현황 +## 서버별 현황 및 설정 관리 문제 ### 51123 서버 - **auth-server** 실행 중 (포트 9000) - JWT 발급 기능 정상 - Redis 임시 코드 시스템 작동 +- ✅ pydantic BaseSettings 사용 -### 51124 서버 +### 51124 서버 - **robing-gateway** 실행 중 - JWT 검증 로직 없음 ⚠️ - 모든 로빙 서비스 운영 +- ❌ **config.py 없음** - os.getenv() 분산 사용 (database.py에서 직접 호출) ### 로컬 개발 - **frontend** 개발 - 토큰 저장은 하지만 전송 안 함 ⚠️ +- API URL 문제: `https://ro-being.com/rb10508` 대신 Gateway URL 사용 필요 + +### 설정 관리 표준화 필요 +| 서비스 | Config 위치 | 상태 | +|--------|------------|------| +| rb10508_micro | app/config.py | ✅ 표준 | +| rb8001 | app/core/config.py | ✅ 표준 | +| skill-slack | app/core/config.py | ✅ 표준 | +| robing-gateway | **없음** | ❌ 비표준 | + +robing-gateway도 BaseSettings 패턴으로 전환 필요 ## 보안 위험 수준