1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-25 04:38:01 +00:00
mpv/player
wm4 bb0650d908 loadfile, ytdl_hook: don't reject EDL-resolved URLs through playlist
The ytdl wrapper can resolve web links to playlists. This playlist is
passed as big memory:// blob, and will contain further quite normal web
links. When playback of one of these playlist entries starts, ytdl is
called again and will resolve the web link to a media URL again.

This didn't work if playlist entries resolved to EDL URLs. Playback was
rejected with a "potentially unsafe URL from playlist" error. This was
completely weird and unexpected: using the playlist entry directly on
the command line worked fine, and there isn't a reason why it should be
different for a playlist entry (both are resolved by the ytdl wrapper
anyway). Also, if the only EDL URL was added via audio-add or sub-add,
the URL was accessed successfully.

The reason this happened is because the playlist entries were marked as
STREAM_SAFE_ONLY, and edl:// is not marked as "safe". Playlist entries
passed via command line directly are not marked, so resolving them to
EDL worked.

Fix this by making the ytdl hook set load-unsafe-playlists while the
playlist is parsed. (After the playlist is parsed, and before the first
playlist entry is played, file-local options are reset again.) Further,
extend the load-unsafe-playlists option so that the playlist entries are
not marked while the playlist is loaded.

Since playlist entries are already verified, this should change nothing
about the actual security situation.

There are now 2 locations which check load_unsafe_playlists. The old one
is a bit redundant now. In theory, the playlist loading code might not
be the only code which sets these flags, so keeping the old code is
somewhat justified (and in any case it doesn't hurt to keep it).

In general, the security concept sucks (and always did). I can for
example not answer the question whether you can "break" this mechanism
with various combinations of archives, EDL files, playlists files,
compromised sites, and so on. You probably can, and I'm fully aware that
it's probably possible, so don't blame me.
2019-01-05 09:11:18 +01:00
..
javascript js: use new hooks API (match f60826c3) 2018-04-07 16:02:20 -07:00
lua loadfile, ytdl_hook: don't reject EDL-resolved URLs through playlist 2019-01-05 09:11:18 +01:00
audio.c build: make encoding mode non-optional 2018-05-03 01:08:44 +03:00
client.c player: make playback termination asynchronous 2018-05-24 19:56:35 +02:00
client.h command: add infrastructure for async commands 2018-05-24 19:56:34 +02:00
command.c command: make playlist builtin OSD property show titles instead of URLs 2019-01-05 09:11:18 +01:00
command.h command: add a way to abort asynchronous commands 2018-05-24 19:56:34 +02:00
configfiles.c demux, stream: remove unneeded crap (esp. optical discs and Linux TV) 2018-08-31 13:53:43 +02:00
core.h demux, stream: rip out the classic stream cache 2018-08-31 12:55:22 +02:00
external_files.c player: get rid of mpv_global.opts 2018-05-24 19:56:35 +02:00
external_files.h player: get rid of mpv_global.opts 2018-05-24 19:56:35 +02:00
javascript.c js: use new hooks API (match f60826c3) 2018-04-07 16:02:20 -07:00
loadfile.c loadfile, ytdl_hook: don't reject EDL-resolved URLs through playlist 2019-01-05 09:11:18 +01:00
lua.c lua: expose mpv_abort_async_command() 2018-05-24 19:56:34 +02:00
main.c player: get rid of mpv_global.opts 2018-05-24 19:56:35 +02:00
misc.c stream: redo buffer handling and allow arbitrary size for stream_peek() 2018-10-02 19:59:22 +02:00
osd.c demux: simplify API for returning cache status 2018-09-07 22:26:48 +02:00
playloop.c demux: simplify API for returning cache status 2018-09-07 22:26:48 +02:00
screenshot.c command: add a way to abort asynchronous commands 2018-05-24 19:56:34 +02:00
screenshot.h command: move screenshot command stubs to screenshot.c 2018-05-24 19:56:34 +02:00
scripting.c scripting: change when/how player waits for scripts being loaded 2018-04-18 01:17:41 +03:00
sub.c player: don't cache subtitles across deselection 2018-06-30 17:15:29 +02:00
video.c video: trust container FPS early on if possible 2018-05-24 19:56:34 +02:00