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

player: add mpv:// protocol to open safe protocols #15898

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

kasper93
Copy link
Contributor

This is useful to run mpv from URL handler. Can be used to start mpv from you web browser or anything that would trigger url handler for given protocol.

Current solutions to run mpv in such context are to spawn IPC proxy and run mpv when requested, but this is in most cases not necessary.

Currently the protocol is added in mpv.desktop. Windows related registration will follow in future changes.

@kasper93
Copy link
Contributor Author

kasper93 commented Feb 17, 2025

This is likely security consideration of running arbitrary file, from handler. Needs to be evaluated.

Copy link

github-actions bot commented Feb 17, 2025

Download the artifacts for this pull request:

Windows
macOS

@guidocella
Copy link
Contributor

#7985

@kasper93 kasper93 marked this pull request as draft February 17, 2025 22:54
@kasper93
Copy link
Contributor Author

As discussed on IRC, I will make this allow only "safe" protocols to open. Which is already status quo with ytdl:// protocol.

@kasper93 kasper93 changed the title player: add mpv:// protocol player: add mpv:// safe protocol Feb 17, 2025
@kasper93 kasper93 changed the title player: add mpv:// safe protocol player: add mpv:// protocol to run safe protocols Feb 17, 2025
@kasper93 kasper93 changed the title player: add mpv:// protocol to run safe protocols player: add mpv:// protocol to open safe protocols Feb 17, 2025
@kasper93 kasper93 marked this pull request as ready for review February 23, 2025 03:53
@kasper93
Copy link
Contributor Author

kasper93 commented Feb 23, 2025

I've updates to handle only safe protocols and also allowed safe protocols to handle bit more.

EDIT: Removed also handling from macos.

@kasper93 kasper93 force-pushed the mpv-protocol branch 3 times, most recently from 50766ca to bb6fb3e Compare February 23, 2025 04:56
@kasper93 kasper93 force-pushed the mpv-protocol branch 3 times, most recently from 43e0192 to bb58a1a Compare February 24, 2025 03:25
This is useful to run mpv from URL handler. Can be used to start mpv
from you web browser or anything that would trigger url handler for
given protocol. Only safe protocols are allowed.

Current solutions to run mpv in such context are to spawn IPC proxy and
run mpv when requested, but this is in most cases not necessary.

Currently the protocol is added in mpv.desktop. Windows related
registration will follow in future changes.
It has been moved to the mpv core with additional security
considerations, including filtering unsafe protocols from being opened
via the URL handler.

While we are not aware of any active exploitation, naive protocol
handling could allow the use of niche protocols in FFmpeg, which, in
turn, might load native code. How such native code would be dropped on
the local machine is another question.

This remains theoretical, but it's better to be safe than sorry.

Fixes: 494d408
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.

3 participants