docs: 로그인 인증 시스템 보안 개선 문서 업데이트

- Frontend 코드 구체적인 수정 사항 추가
- robing-gateway 설정 관리 문제 추가
- 서버별 현황 상세화
This commit is contained in:
happybell80 2025-08-15 12:51:28 +09:00
parent 1e38639d46
commit 726e295f76

View File

@ -60,15 +60,61 @@
## 긴급 수정 필요사항
### Frontend 수정
```javascript
// API 클라이언트에 토큰 헤더 추가
const apiCall = async (endpoint, data) => {
const token = localStorage.getItem('auth_token');
const headers = {
### robing-api.ts 수정 필요
```typescript
// 현재 문제: 토큰 전송 안 함, 하드코딩된 userId
export async function sendMessage(text: string, userId: string = 'test_user'): Promise<MessageResponse> {
const response = await fetch(`${ROBING_API_URL}/api/chat`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': token ? `Bearer ${token}` : '' // 추가!
'X-User-Id': userId // ❌ 토큰 없음, 조작 가능
},
body: JSON.stringify({
message: text,
user_id: userId
})
});
}
// 수정 필요
export async function sendMessage(text: string, token: string, userId: string): Promise<MessageResponse> {
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 서버
- **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 패턴으로 전환 필요
## 보안 위험 수준