Skip to content

[Security][Chatbot] Embed Origin·CORS·CSP 보안 경계 분리 #353

Description

@HyungminYoon1

배경

Conversation Memory 및 Chatbot deployment 문서는 deployment-owned exact Origin/embed/CSP allowlist를 하나의 설정처럼 기술한다. 그러나 /embed/chat/{slug} iframe 내부 API 요청의 browser Origin은 부모 사이트가 아니라 Nodease iframe 문서의 origin이다.

이 구분이 없으면 부모 embed origin을 API CORS allowlist에 넣거나, 반대로 API 호출 origin 설정으로 iframe 부모 허용을 통제한다고 오해할 수 있다.

문제

다음 세 경계가 현재 문서에서 혼합되어 있다.

  1. Direct JavaScript client가 API를 호출할 때의 CORS allowed origin
  2. Nodease iframe 문서가 API를 호출할 때의 first-party origin
  3. 외부 부모 사이트가 iframe을 삽입할 수 있는 CSP frame-ancestors 허용 목록

부모 페이지 origin은 iframe 내부 fetch의 Origin header로 전달되지 않으므로 CORS만으로 부모 embed site를 검증할 수 없다.

작업 범위

  • API CORS allowed origins와 CSP frame-ancestors embed parent origins를 별도 정책으로 정의
  • First-party Nodease iframe origin과 direct JS client 지원 여부를 명시
  • Public credential-less API와 authenticated cookie API의 CORS/Origin/CSRF 경계를 분리
  • Missing/null/unlisted Origin, wildcard와 environment fallback의 처리 정의
  • Deployment-owned 저장 필드, 관리자 갱신 API, validation과 safe response 계약 정의
  • 설정을 immutable deployment version 또는 snapshot에 binding하고 active pointer 변경 시 기존 session 동작 정의
  • Reverse proxy/custom domain 환경에서 canonical origin을 결정하는 신뢰 경계 정의
  • ADR-0030의 결합된 Origin/embed allowlist 문구를 수정하거나 전용 후속 ADR 작성
  • Conversation Memory, Chatbot deployment, Gateway/API 및 배포 문서 정합화

필수 테스트

  • 허용된 부모 origin은 iframe embedding 가능하지만 미등록 부모는 CSP에서 차단
  • iframe 내부 API 요청은 first-party Nodease origin 기준으로 정상 처리
  • Direct JS client를 지원한다면 등록된 CORS origin만 허용
  • 부모 embed origin을 CORS origin으로 오인해 권한을 넓히지 않음
  • Public endpoint의 optional login/cookie가 private 권한을 부여하지 않음
  • Authenticated mutation은 exact Origin, CSRF token과 Fetch Metadata를 검증
  • Deployment version 변경 후 기존 session이 새 allowlist로 자동 rebind되지 않음
  • wildcard, null Origin과 client/environment fallback은 fail-closed

완료 기준

  • CORS, iframe parent 허용과 first-party iframe origin의 책임이 각각 명확하다.
  • 저장 모델/API/snapshot binding이 구현 가능한 수준으로 정의된다.
  • Accepted ADR과 feature 문서가 충돌하지 않는다.
  • 브라우저 기반 보안 테스트 매트릭스가 작성된다.

Metadata

Metadata

Assignees

Type

No type

Fields

Priority

None yet

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions