Skip to content

Reject browser connections on the client's WebSocket listener - #324

Merged
arturpragacz merged 3 commits into
mainfrom
docs/reject-origin-on-client-listener
Oct 23, 2026
Merged

arturpragacz merged 3 commits into
mainfrom
docs/reject-origin-on-client-listener

Conversation

@maximmaxim345

Copy link
Copy Markdown
Member

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 Origin header 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:// from https:// pages, so only plain http:// pages could reach the listener anyway. A web app that wants to stream to speakers can connect to the server as a source client instead.

References:

Comment thread connection.md Resolved
@arturpragacz
arturpragacz merged commit ab7f903 into main Oct 23, 2026
1 check passed
@arturpragacz
arturpragacz deleted the docs/reject-origin-on-client-listener branch October 23, 2026 04:25
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`
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.

2 participants