Repository navigation
Only let ConnectHub's own page open the stream - #52
Merged
Merged
Conversation
The base image sets SELKIES_ALLOWED_ORIGINS=*, disabling Selkies' check on which pages may open the stream WebSocket. The SameSite=Lax session cookie keeps out other sites, but SameSite is per site, so a page on a sibling subdomain still got the cookie and could view and control the desktop. Restore Selkies' same-origin default (empty). It compares the Origin's hostname with the Host nginx forwards, so proxies, tunnels, LAN access and localhost keep working; other origins can still be listed in compose. Fixes #51 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Fixes #51
What changed
Dockerfile:ENV SELKIES_ALLOWED_ORIGINS=after the base-env check, overriding the base image's*with Selkies' same-origin default. The mirrored baseENVblock keeps*socheck_base_env.shstill verifies it against the base.*).docker-compose.yml: commentedSELKIES_ALLOWED_ORIGINSexample.Why it keeps working behind proxies
Selkies'
_is_origin_allowed()accepts a request whose Origin hostname equals theHostheader when that header has no port. ConnectHub's nginx forwardsHost $host(no port), so the browser's Origin matches regardless of the external port or scheme.Testing
Ran Selkies' real
_is_origin_allowed()(from the deployedstream_server.py) withallowed_originsempty against the requests ConnectHub's setups produce:https://hub.example/Host: hub.example), LANhttp://IP:8080, LANhttps://IP:8443,localhost:8080, non-browser clients without an Originhub.example.evil.example*, the sibling subdomain was allowed (the gap being closed)Not yet tested in a running container; to confirm after deploy, the stream should connect as before.
🤖 Generated with Claude Code