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 패턴으로 전환 필요 ## 보안 위험 수준