Skip to content

Allow LiveKit regional CSP hosts - #37

Merged
jserv merged 1 commit into
mainfrom
fix
Sep 12, 2026
Merged

Allow LiveKit regional CSP hosts#37
jserv merged 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

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.

cubic-dev-ai[bot]

This comment was marked as resolved.

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.

@Patriciaath999 Patriciaath999 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the changes. The CSP now allows LiveKit regional signaling hosts while validating unsafe endpoint formats.

@jserv
jserv merged commit e060265 into main Sep 12, 2026
6 checks passed
@jserv
jserv deleted the fix branch September 12, 2026 16:37
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

3 participants