security: restrict CORS to known local origins#88
Open
dgilperez wants to merge 2 commits intojamiepine:mainfrom
Open
security: restrict CORS to known local origins#88dgilperez wants to merge 2 commits intojamiepine:mainfrom
dgilperez wants to merge 2 commits intojamiepine:mainfrom
Conversation
The wildcard `allow_origins=["*"]` allows any website the user visits to make requests to the local voicebox backend, potentially triggering TTS generation or reading voice profiles without consent. Restrict to the known Tauri webview and Vite dev server origins by default. Users running in remote server mode can set VOICEBOX_CORS_ORIGINS to allow additional origins.
20 tests covering: - All 6 default local origins are allowed - Arbitrary external origins are blocked - Preflight (OPTIONS) requests respect the allowlist - VOICEBOX_CORS_ORIGINS env var extends the allowlist - Edge cases: empty env, whitespace trimming, trailing commas Tests use a minimal FastAPI app mirroring the real CORS config, so they run without ML dependencies (torch, numpy, etc.).
Copilot AI
added a commit
to Patrick-DE/voicebox
that referenced
this pull request
Feb 19, 2026
…ne#88, jamiepine#91, jamiepine#95, jamiepine#97) Co-authored-by: Patrick-DE <14962702+Patrick-DE@users.noreply.github.com>
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.
Summary
allow_origins=["*"]with an explicit allowlist of known local origins (Tauri webview, Vite dev server, localhost API)VOICEBOX_CORS_ORIGINSenv var for users who need additional origins in remote server modeMotivation
The wildcard CORS policy allows any website the user visits to make cross-origin requests to the local voicebox backend (port 17493). A malicious page could silently trigger TTS generation, read voice profiles, or access generation history without user consent.
Allowed origins (default)
http://localhost:5173http://127.0.0.1:5173http://localhost:17493http://127.0.0.1:17493tauri://localhosthttps://tauri.localhostRemote server mode
Users running voicebox as a remote server can extend the allowlist:
VOICEBOX_CORS_ORIGINS="https://my-app.example.com,https://other.example.com" python -m backend.main --host 0.0.0.0Test plan
bun run dev(Vite) connects to backend