Repository navigation
feat(api): CORS 허용 origin을 환경변수로 설정 - #21
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DmBmpFCjUN5yzz3WPSEWva
Contributor
Author
|
@ywkim #17 분할의 B4(CORS)입니다. 재리뷰 부탁드립니다. main에서 바로 시작했고 선행 PR이 없습니다. 리뷰 지적 반영: Generated by Claude Code |
4 of 8 tasks
ywkim
approved these changes
Oct 19, 2026
ywkim
left a comment
Contributor
There was a problem hiding this comment.
@Lee-Soyeon 리뷰 지적을 빠르게 반영해주셔서 감사합니다! 승인합니다.
allow_origin_regex=".*"가 사라지고 허용 origin이 CORS_ALLOWED_ORIGINS로 한정됐습니다. 기존 Settings 컨벤션과도 일치합니다.
확인한 항목
- CI:
backend-ci가 head2d351de에서 success (unit-test 단계 포함). 로컬에는pydantic_settings가 없어 테스트를 직접 돌리지 못해 CI 결과로 대체했습니다. - Starlette
middleware/cors.py를 직접 읽었습니다. 목록 origin은 정확히 일치할 때만 허용하고,"*"이 목록에 있으면서allow_credentials=True이면 요청 Origin을 그대로 반사합니다. - 운영 배포 설정: 미확인. 저장소에
main.py배포 설정이 없어 운영의CORS_ALLOWED_ORIGINS설정 여부는 확인하지 못했습니다. 설정 전에 배포되면 운영 프런트 요청이 CORS로 막힙니다.
비차단 (머지 후 후속 가능)
settings.py:CORS_ALLOWED_ORIGINS=*를 막지 않습니다. 위 Starlette 동작 때문에 쿠키 요청에서 모든 origin이 허용돼 이 PR이 막으려던 위험이 재현됩니다.*거부 검증과 테스트 1건을 권합니다.settings.py: origin을 정규화하지 않습니다.https://a.com/처럼 끝 슬래시가 붙으면 Origin 헤더와 영원히 불일치해, 오류 없이 CORS만 실패합니다.README.md:frontend/.env.development가 API를127.0.0.1:8000으로 가리키므로, 프런트를http://127.0.0.1:3000으로 열면 기본값으로는 막힙니다. 한 줄 안내를 권합니다.
Generated by Claude Code
Lee-Soyeon
pushed a commit
that referenced
this pull request
Oct 21, 2026
Hedra 아바타 삭제는 별도 PR로 분리한다. main(#21, #28)을 병합하고 Fish Audio -> ElevenLabs TTS 교체만 남긴다 (hedra extra와 코드 유지). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HtQpw2nbQZLwzSJGbw5E3C
2 of 4 tasks
Lee-Soyeon
added a commit
that referenced
this pull request
Oct 21, 2026
## 요약 AI 아이돌 통화의 음성을 Fish Audio에서 **ElevenLabs TTS**로 바꿉니다. Hedra 아바타 삭제와 LiveKit Agents 1.8 업그레이드는 리뷰 요청에 따라 이 PR에서 **뺐습니다** (각각 별도 PR). `livekit-agents`는 1.2.18 그대로입니다. ## 변경 사항 ### 음성 (TTS) - Fish Audio → **ElevenLabs** (`eleven_flash_v2_5`). `FANCALL_ELEVENLABS_MODEL`로 모델 변경 가능. - API 키는 `ELEVEN_API_KEY` (`ElevenLabsSettings` 추가). - extra를 `fishaudio` → `elevenlabs`로 교체 (`hedra` extra는 유지). `poetry.lock`은 main 대비 fish 플러그인 의존성 제거와 `livekit-plugins-elevenlabs` 추가만 바뀝니다. - 기본 페르소나(은우)의 Fish voice ID 제거. voice ID가 없으면 ElevenLabs 기본 목소리 사용. ### 호출하는 쪽에 영향 - `create_worker_options()`: `fish_settings` → `elevenlabs_settings`. 호스트 앱이 직접 호출하면 함께 수정 필요. `hedra_settings`는 그대로입니다. - `voice_id`는 ElevenLabs voice ID여야 함 (README, `schemas.ts` 주석에 안내). ### 이 PR에 없는 것 - Hedra 삭제: 별도 PR - LiveKit Agents 1.8 업그레이드: 별도 PR (`feat/livekit-agents-1.8`) main(#21, #28)을 병합해 충돌을 풀었습니다. ## 테스트 - [x] `make -C backend lint` 10/10, `type-check` 오류 0, `unit-test` 23/23 통과 - [x] (이전 커밋 기준) 로컬 LiveKit dev 서버에서 ElevenLabs 음성으로 응답 확인 - [ ] 브라우저 실제 통화 화면 확인 - [ ] 은우용 ElevenLabs voice ID 지정 확인 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01HtQpw2nbQZLwzSJGbw5E3C --------- Co-authored-by: Claude <noreply@anthropic.com>
Lee-Soyeon
added a commit
that referenced
this pull request
Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
요약
API 서버가 쿠키를 실은 요청을 환경변수(
CORS_ALLOWED_ORIGINS)에 적은 사이트에만 허용합니다.목적
프런트엔드는
credentials: "include"로 요청해서,allow_origins=["*"]는 브라우저가 거부합니다. #17은 이를allow_origin_regex=".*"로 바꿨는데,allow_credentials=True와 함께 쓰면 모든 사이트가 쿠키를 실은 요청의 응답을 읽을 수 있어 위험합니다 (리뷰 지적). 허용 목록을 환경변수로 받도록 고칩니다.변경 사항
CorsSettings추가:CORS_ALLOWED_ORIGINS(쉼표로 구분)에 적힌 origin만 허용합니다.http://localhost:3000하나입니다. 운영에서는 실제 프런트 도메인으로 설정해야 합니다.backend/README.md환경변수 표에 추가했습니다.allow_origin_regex=".*"는 쓰지 않습니다.테스트
make -C backend format / unit-test통과 (23개), 기본값·쉼표 파싱 단위 테스트 추가lint/type-check가worker.py의livekit.plugins.fishaudio/hedraimport를 못 찾는다고 나오는 것은 제 로컬 가상환경이 feat(agent): TTS를 Fish Audio에서 ElevenLabs로 교체 #15 의존성이라서이며, 이 PR의 변경과 무관합니다 (main 그대로).CORS_ALLOWED_ORIGINS에 적은 도메인의 프런트에서 쿠키 요청이 되는지🤖 Generated with Claude Code
https://claude.ai/code/session_01DmBmpFCjUN5yzz3WPSEWva
Generated by Claude Code