Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http: allow local files to access websocket (Fixes #1711) #1712

Merged
merged 1 commit into from Oct 8, 2018

Conversation

kingosticks
Copy link
Member

check_origin() still ensures the Origin header is set but now only blocks
when missing from the allowed list if a network location was extracted
from the header. This prevents websocket connections originating from
local files (common in Apache Cordova apps such as Mopidy-Mobile) from
being blocked; these files don't really have a sensible value for Origin
so the client browser sets the header to something like 'file://' or
'null'.

Also added some tests for check_origin().

@kingosticks kingosticks requested review from jodal and tkem October 8, 2018 22:03
Copy link
Member

@jodal jodal left a comment

Choose a reason for hiding this comment

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

LGTM!

Please rebase on top of release/2.2 and add a 2.2.1 changelog entry.

@jodal jodal added this to the v2.2.1 milestone Oct 8, 2018
@kingosticks kingosticks changed the base branch from develop to release-2.2 October 8, 2018 22:26
@kingosticks kingosticks changed the base branch from release-2.2 to develop October 8, 2018 22:27
@kingosticks kingosticks changed the base branch from develop to release-2.2 October 8, 2018 22:30
check_origin() still ensures the Origin header is set but now only blocks
when missing from the allowed list *if* a network location was extracted
from the header. This prevents websocket connections originating from
local files (common in Apache Cordova apps such as Mopidy-Mobile) from
being blocked; these files don't really have a sensible value for Origin
so the client browser sets the header to something like 'file://' or
'null'.

Also added some tests for check_origin().
@kingosticks
Copy link
Member Author

Got there in the end

@jodal jodal merged commit 9f7b347 into mopidy:release-2.2 Oct 8, 2018
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.

None yet

2 participants