Repository navigation
fix(producer): scheme-prefixed media sources stay inside the project - #7851
Merged
Merged
Conversation
…t folder The outside-project media check skipped any src starting with data:, blob:, about: or http(s): in any letter case, while the readers resolve everything but exact http:// and https:// URLs as a local path. A src such as data:x/../../outside/clip.mp4 passed the check and the readers opened the file it named. The check and the media type preflight now use the readers' remote test, isHttpUrl, and check every other src with a shared containment helper, isInsideAssetRoots. Frame extraction, the audio mix, and the HDR and video sound probes also refuse a local source outside the project, compiled and download folders on their own when outside files are not allowed.
Contributor
jrusso1020
approved these changes
Nov 15, 2026
jrusso1020
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed at 13177f1efa96ea0f9f524efa91baf752842f44e5. APPROVE: I found nothing blocking. There are 3 nits and 2 pre-existing follow-ups below.
Need: yes, data:x/../../outside/clip.mp4 passed the outside-project gate while ffmpeg opened it as a path · Size: ok · Reuse: isSafePath (escapesAssetRoot lives in producer, which the engine can't import, so the new engine helper is justified) · Simpler: already minimal · Structure: fine (checked escapesAssetRoot, isSafePath, isWithinProjectRoot; no split)
Risk: low — narrows what the gate keeps; projects with inside media, real data:/blob:/https sources, and allowOutsideProjectAssets renders behave as before
What I checked
- The gate and the readers now test sources the same way. The gate (
assetMediaType.ts:111-113), the preflight (:171),extractAllVideoFrames(videoFrameExtractor.ts:2240-2257),processCompositionAudio(audioMixer.ts:1493-1514) and the extract-stage HDR and sound probes (extractVideosStage.ts:477,529,689-699) all do the same two things. They callisHttpUrl(urlDownloader.ts:1605, exacthttp://orhttps://only) to decide remote vs local. They resolve local sources withresolveProjectRelativeSrc(src, projectDir, compiledDir). - Probe on a real temp tree. The tree had a symlink inside the project pointing out. I ran the built
resolveProjectRelativeSrc,isInsideAssetRootsandisHttpUrlon it.- Resolve outside and are refused:
data:,DATA:,blob:,about:andHTTP:followed by../..;data:x/../link/clip.mp4through the symlink;file://;//abs;%2e%2e/; and..%2f. - Resolve to missing files inside the project:
http:/x,HTTP://h/x,http://h/xand\\?\…. - A real 5 KB
data:URL takes the ENAMETOOLONG fallback inisInsideAssetRootsand reads as missing, as on main.
- Resolve outside and are refused:
- Every spawn reachable from a composition src is covered.
- The extractor, the audio mix and the extract-stage probes refuse on their own.
captureHdrResources,oversizedVideos, the passthrough layer and the preflight run after the gate with the same resolver.- The compiler probes and GIF/HEIC prep keep their existing
escapesAssetRoot(projectDir)checks. - In-process and Plan v2 both pass
allowOutsideProjectAssetsthrough.
- ffmpeg protocols. A src can't pick an ffmpeg protocol (
concat:,subfile:,pipe:): every local input reaches ffmpeg as an absolute path. Playlist contents are checked byplaylistLeavesItsFolder, and this PR extends that check to project files named behind a scheme. - Real
data:media is never decoded or written to a temp file. It reads assource_missing/source_not_found, as before. Only HEIC images are decoded fromdata:, in memory, and that was already the case. - Tests (
bunx vitest runinpackages/producer):- At head, the PR's three test files pass 50/50.
- With only the 8 non-test source files reverted to the merge base
88ffe087, 11 of 50 fail: the gate, the preflight sniff, in-process, Plan v2, each reader, and the audioStage config. - Engine
audioMixer.test.tsandvideoFrameExtractor.test.tspass 228/228.
Nits (non-blocking)
mediaAssetRootsbuilds the downloads folder fromdirname(compiledDir)(assetMediaType.ts:97). Plan v2 mixes audio withfinalCompiledDir(plan.ts:1656), which makes its downloads rootplanDir/downloads. Compile downloads intoplanDir/.plan-work/downloads. A path outside the roots is refused, never allowed, so this can only refuse too much. It has no effect today because localized media is copied intocompiled. Building the roots fromworkDir, or passing them in, would keep the list honest.- Add a small engine test for
isInsideAssetRootsto pin the symlink-inside-a-root case and the ENAMETOOLONG fallback. - The remaining
/^https?:\/\//ichecks (ffprobe.ts:389,451,videoShownBoxes.ts:25,videoFrameExtractor.ts:820) differ fromisHttpUrlonly in the safe direction: they skip the local read. Switching them toisHttpUrlwould leave one remote test everywhere.
Pre-existing follow-ups (not this PR)
- Local ffmpeg/ffprobe inputs get no
-protocol_whitelist;urlInput.ts:35covers only https inputs on render services. Adding-protocol_whitelist fileon local inputs would be cheap defense in depth. captureHdrResources,oversizedVideosand the passthrough layer rely on the gate alone. They use the same resolver, so they agree today. A reader-side check there would match the readers this PR hardened.
Review by Rames
miguel-heygen
added a commit
that referenced
this pull request
Nov 15, 2026
miguel-heygen
added a commit
that referenced
this pull request
Nov 15, 2026
Merged
daedal-ping Bot
pushed a commit
to DaedalGames/hyperframes
that referenced
this pull request
Nov 15, 2026
* chore: release v0.9.54 * chore: release v0.9.54 notes include heygen-com#7827, heygen-com#7825, heygen-com#7845, heygen-com#7848 and heygen-com#7849 * chore: release v0.9.54 notes include heygen-com#7853 * chore: release v0.9.54 notes include heygen-com#7851 and heygen-com#7855
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
Media sources that start with a URL scheme such as
data:orblob:can no longer reach files outside the project when a render may not read outside files.dropMediaOutsideProject) and the media type preflight now use the same remote test as the readers,isHttpUrl. Every othersrcis resolved to the file the readers would open and is checked against the project, compiled and download folders, with symlinks resolved.extractAllVideoFrames), the audio mix (processCompositionAudio), and the HDR and video sound probes in the extract stage. A refused video reads as a missing source, and a refused audio track is reported as a source that was not found.isInsideAssetRoots, holds the containment check that the gate and the readers share.Why
The check that leaves out media outside the project skipped any
srcstarting withdata:,blob:,about:orhttp(s):in any letter case. The readers only treat exacthttp://andhttps://URLs as remote, and they resolve everything else as a path. A source such asdata:x/../../outside/clip.mp4therefore passed the check, andpath.joinremoved the scheme segment with the first.., so ffprobe and ffmpeg opened a file outside the project. This matters for renders that may not read outside files: render services, and CLI or Studio renders of a composition someone else sent.Related work
Refs #7792. #7838 also edits
videoFrameExtractor.ts; the two changes touch different steps and merge cleanly.How
isHttpUrl). Every other source goes throughresolveProjectRelativeSrcand the shared containment check, so the preflight also sniffs a project file named behind a scheme.isInsideAssetRootsuses the existingisSafePathcheck. A path that names no file passes when it is spelled inside a root, because nothing can be opened there. This covers a long inlinedata:URL, which the file system cannot name. Genuine inline media therefore reads as missing, as it does today, rather than as outside the project.allowOutsideProjectAssetsis set. The plan audio path and the in-process render pass the job's setting through.Projects whose media is inside the project, genuine
data:,blob:andhttps://sources, and renders that allow outside files behave as before.Test plan
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
assetMediaType.test.ts: sources such asdata:,DATA:,Blob:,about:andHTTP:followed by parent folders are dropped. Genuine inline, blob, remote and local sources are kept, including a longdata:URL. The preflight sniffs a project file named behinddata:orBLOB:.outsideProjectAssets.test.ts: the in-process and Plan v2 renders drop scheme-prefixed sources that leave the project and never pass the outside file to ffprobe or ffmpeg. With the gate bypassed, frame extraction, the HDR probes, the video sound probes and the audio mix each refuse the outside source. Every spawned process is recorded to check this.These tests fail on
mainand pass with this change.tsc --noEmitpasses for engine and producer. The related producer stage, plan and orchestrator suites and the engine mixer and extractor suites show no new failures.