Skip to content

Allow LiveKit regional CSP hosts - #37

Open
jserv wants to merge 1 commit into
mainfrom
fix
Open

Allow LiveKit regional CSP hosts#37
jserv wants to merge 1 commit into
mainfrom
fix

Conversation

@jserv

@jserv jserv commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

LiveKit Cloud can redirect a browser to a regional signaling host after the configured endpoint. Keep the corresponding Cloud wildcard beside the exact HTTP and WebSocket sources, while rejecting endpoint spellings that cannot safely appear in a CSP.

Closes #36

LiveKit Cloud can redirect clients to regional signaling hosts.
Allow its Cloud wildcard beside exact HTTP and WebSocket origins.
Reject URL spellings unsafe for CSP sources.
cubic-dev-ai[bot]

This comment was marked as resolved.

@jserv
jserv requested a review from alanhc September 11, 2026 02:45
@alanhc

alanhc commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Tests pass locally (205 unit tests).

The substantive change here is csp_origin, not the wildcard: the previous path went through url_origin alone, which only checks for printable ASCII, so a configured wss://host;script-src=* reached the header verbatim and the semicolon terminated connect-src early. Rejecting the endpoint and withholding its Cloud wildcard is the right call, and the test pins it.

Two notes:

  • The host-character check would sit better in validate_livekit_url. As it stands a malformed host still starts the server and fails only in the browser, which is the shape of failure the rest of this file argues against.
  • The _ => return vec![origin] arm in livekit_origins_for_csp_origin is now unreachable: every endpoint passes validate_livekit_url, so the scheme is one of the four.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CSP blocks connections to LiveKit regional endpoints

2 participants