Repository navigation
fix(engine): media playlists are checked through every list they name - #7778
Merged
Merged
Conversation
Contributor
Edit accuracy: accurate 267 (base branch 267), smooth 109 of thoseThe gate passes. Quarantined, measured but not gated (8)
Unstable (1)
|
Merged
3 of 4 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.
What
A media playlist is now checked through every list it names, not only its own lines. A master playlist pointing at a variant list in a subfolder, which in turn names a file outside the top folder, is refused before ffprobe or ffmpeg opens it. Nested lists are read up to 8 deep, each list once.
A downloaded file that is such a playlist is refused before it is saved under its final name, the same way the downloader already refuses HTML and JSON error documents. It never sits in the download folder for another list to name.
Why
The folder rule from #7768 has to hold for everything ffmpeg will follow, and ffmpeg follows nested lists.
Related work
Refs #7768.
How
playlistLeavesItsFolderwalks local entries that are themselves playlists, resolving each against its own list's folder and keeping it inside the top list's folder. A chain deeper than 8 is refused. Lists already seen are skipped, so a cycle ends.placedAtpath, so the downloader can check the staged file as if it were already in the download folder.downloadToTempruns the check on the staged download and throws a non-retryableinvalid_payloaderror, which callers already treat as a bad source.Test plan
fails without the fix:
packages/engine/src/utils/notMediaPayload.test.ts"refuses a list whose nested list names a file outside the top folder", "refuses a nested list that steps above the top folder from its own" and "refuses lists nested deeper than it reads" fail on main;packages/engine/src/utils/urlDownloader.test.ts"never publishes a downloaded playlist that ..." (2 cases) fail without the downloader check.With the fix, three runs in a row: engine
notMediaPayload,urlDownloader,urlDownloader.progressandurlDownloader.publicAddresstests 147 of 147.htmlCompiler.test.ts183 of 183 under the unit lane's no-network preload,assetMediaType.test.ts17 of 17, audio mixer tests 139 of 139.On Linux with ffmpeg 8.0.1, a compile of a
<video>pointing at a master list whose variant list names an outside file runs ffprobe twice and opens that file on main. With the fix it stops with the not-media error and ffprobe never runs (traced).Mutations, each reverted and each caught: dropping the downloader check, ignoring
placedAt, no recursion, no depth cap, no cycle guard, and checking nested entries against their own folder instead of the top one.Engine and producer typecheck, oxlint and oxfmt clean.
Unit tests added/updated
Manual testing performed
Documentation updated (if applicable)
Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug