Repository navigation
Reject browser connections on the client's WebSocket listener - #324
Merged
Merged
Conversation
11 of 12 tasks
arturpragacz
requested changes
Oct 23, 2026
arturpragacz
approved these changes
Oct 23, 2026
maximmaxim345
added a commit
to Sendspin/aiosendspin
that referenced
this pull request
Nov 17, 2026
# What does this implement/fix? <!-- Quick description and explanation of changes. --> The client listener accepted WebSocket upgrades that carry an `Origin` header, so a web page on the same network could connect to a client and act as its server. It now answers those upgrades with 403 before the connection handler runs. Servers don't send `Origin`, so they connect as before. **Related issue or spec PR (if applicable):** - Sendspin/spec#324 ## Types of changes <!-- Tick exactly one box. CI (.github/workflows/pr-labels.yaml) applies the matching label, and the release notes use it to sort this change. --> - [x] Bugfix (non-breaking change which fixes an issue): `bugfix` - [ ] New feature (non-breaking change which adds functionality): `new-feature` - [ ] Enhancement to an existing feature: `enhancement` - [ ] Breaking change (changes the public API or the protocol in a way that is not backwards compatible): `breaking-change` - [ ] Refactor (no behavior change): `refactor` - [ ] Documentation only: `documentation` - [ ] Maintenance / chore: `maintenance` - [ ] CI / workflow change: `ci` - [ ] Dependencies bump: `dependencies`
48 of 58 tasks
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.
A web page opened in a browser on the same network can connect to a client's WebSocket listener and act as a server, for example to start pairing attempts or take over playback when unpaired access is enabled.
Servers never connect from a browser, and browsers always send an
Originheader on the WebSocket upgrade that page scripts can't remove. So clients now reject any upgrade to their advertised path that carries one, and servers must not send one when they connect to a client.This doesn't block any real use case. Browsers block
ws://fromhttps://pages, so only plainhttp://pages could reach the listener anyway. A web app that wants to stream to speakers can connect to the server as asourceclient instead.References:
https://www.rfc-editor.org/rfc/rfc6455#section-4.1
https://fetch.spec.whatwg.org/#append-a-request-origin-header
https://fetch.spec.whatwg.org/#forbidden-request-header
I accept the Contributor License Agreement for this contribution.