Principle:0xsline OpenChatCut Media Materialization
| Knowledge Sources | |
|---|---|
| Domains | Media_Processing, Security, Video_Export |
| Last Updated | 2026-10-22 14:00 GMT |
Overview
Principle that resolves all render-visible external media references into local, same-origin file paths before rendering begins, ensuring the renderer never fetches remote URLs and all media is verified, bounded, and cleanable.
Description
Media Materialization is the bridge between export planning and rendering. An export plan may reference media by remote URL, local upload path, or product-asset path. Before the renderer (Remotion) starts, every render-visible reference must be a local, same-origin file path.
The materialization process:
- Collects all media references from the timeline/project snapshot.
- Validates local references (checks they exist and are safe).
- Downloads remote references through an SSRF-safe fetcher with byte and time bounds.
- Publishes downloaded files atomically into the controlled upload directory.
- Replaces all remote URLs in the snapshot with local paths.
- Freezes the snapshot (deep immutable) so the renderer sees a stable view.
- Returns a cleanup function that removes temporary files after rendering.
This principle ensures the renderer operates on verified, local, immutable media — no network calls during rendering, no SSRF exposure, no partial downloads.
Usage
Use this principle when:
- Building a render pipeline where the renderer must not make network calls.
- Preventing SSRF attacks through user-supplied media URLs.
- Ensuring all render-visible media is downloaded, verified, and bounded before rendering starts.
- Providing clean resource teardown after rendering completes.
Theoretical Basis
The mechanism combines content-addressed publishing with SSRF-safe fetching and snapshot freezing:
- Collect: Walk the snapshot to find all media references.
- Classify: Separate local (file path) from remote (http/https URL).
- Validate local: Check existence, safety, and path traversal.
- Fetch remote: Download through SSRF guard (block private IPs, limit bytes/time).
- Publish: Atomically write to the controlled upload directory.
- Replace: Substitutes remote URLs with local paths in the snapshot.
- Freeze: Deep-freeze the snapshot so it cannot change during rendering.
- Cleanup: Return a function to remove temporary files.
Related Pages
Implemented By
- Implementation:0xsline_OpenChatCut_MaterializeServerExportMedia
- Implementation:0xsline_OpenChatCut_AcceptExportSubmission