다크 모드
Security
MSAP Chat SDK의 보안 메커니즘을 설명합니다.
인증 시스템
MSAP Chat SDK는 applicationKey 기반 인증 시스템을 사용합니다.
SDK 초기화 시 제공된 applicationKey가 Widget에 전달되며, Widget은 모든 API 요청에 이 키를 X-Application-Key 헤더로 포함합니다. Backend는 요청의 Origin과 applicationKey를 함께 검증하여 인증된 요청만 처리합니다.
보안 메커니즘
1. Origin 검증
브라우저의 Origin 헤더로 도메인을 자동 검증합니다.
Origin: https://example.com
→ Backend: allowedOrigins에 등록된 도메인인지 확인2. applicationKey
등록된 applicationKey만 사용 가능합니다.
javascript
MSAPChat.init({
applicationKey: 'registered-key-only', // Backend에 등록된 키만 허용
});3. CORS
allowedOrigins에 등록된 도메인만 허용합니다.
Access-Control-Allow-Origin: https://example.com4. Rate Limiting
추후 지원 예정
Rate Limiting 기능은 현재 개발 중입니다.
IP + applicationKey 기반으로 요청을 제한할 예정입니다.
Rate Limit: 100 requests / minute per IP + applicationKey (추후 적용)applicationKey 보호
클라이언트 노출 안전
applicationKey는 클라이언트 측에 노출되어도 안전하도록 설계되었습니다.
왜 안전한가요?
- Origin 검증: Backend에서 요청 Origin과 등록된 allowedOrigins를 비교
- 이중 검증: applicationKey + Origin 조합으로 검증
- 도메인 제한: 등록된 도메인에서만 작동
예시
javascript
// [X] 다른 도메인에서 복사해도 작동하지 않음
// https://attacker.com
MSAPChat.init({
applicationKey: 'stolen-key', // Origin 불일치로 실패
});
// [O] 등록된 도메인에서만 작동
// https://example.com (allowedOrigins에 등록됨)
MSAPChat.init({
applicationKey: 'your-key', // Origin 일치로 성공
});보안 모범 사례
1. HTTPS 사용
항상 HTTPS를 사용하여 통신을 암호화하세요.
html
<!-- Good -->
<script src="https://sdk.turacocloud.com/msap-ai-chat.min.js"></script>
<!-- Bad -->
<script src="http://sdk.turacocloud.com/msap-ai-chat.min.js"></script>2. 환경 변수 사용
프로덕션 환경에서는 환경 변수로 applicationKey를 관리하세요.
javascript
// React
const widget = MSAPChat.init({
applicationKey: process.env.REACT_APP_CHAT_KEY,
});
// Vue
const widget = MSAPChat.init({
applicationKey: import.meta.env.VITE_CHAT_KEY,
});3. Content Security Policy (CSP)
CSP를 사용하는 경우 다음 도메인을 허용하세요.
html
<meta
http-equiv="Content-Security-Policy"
content="
script-src 'self' https://sdk.turacocloud.com;
frame-src https://ai-chat.turacocloud.com;
connect-src https://api.turacocloud.com;
"
/>취약점 보고
보안 취약점을 발견하신 경우:
- 이메일: ai@twolinecloud.com
- 비공개 보고: 공개 이슈로 제보하지 마세요
다음 단계
- Options - 설정 옵션
- React Integration - React에서 안전하게 사용하기
- API Methods - API 레퍼런스