镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

fix(media): restrict ffmpeg inputs to media demuxers - #9577

Merged
waleedlatif1 merged 3 commits into
stagingfrom
fix/ffmpeg-input-format-whitelist
Nov 2, 2026
Merged

waleedlatif1 merged 3 commits into
stagingfrom
fix/ffmpeg-input-format-whitelist

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • FFmpeg picks an input's demuxer from its bytes, not its filename. An uploaded DASH manifest declared as video/mp4 was demuxed as DASH and pulled media from a path outside the operation's temp dir into the output (reproduced against the shipped ffmpeg 7.1 via convert, probe, and the STT video path)
  • Every ffmpeg/ffprobe input now carries -format_whitelist limited to media containers (mov/mp4, matroska/webm, avi, flv, asf, mpegts, mpeg, mp3, wav, ogg, flac, aac, aiff, amr, caf, png/jpeg/webp/gif), so concat, hls, dash, and imf can no longer be selected by content
  • A demuxer the code forces with -f (our own concat list, the lavfi silence source) is added to that input's whitelist rather than exempting it, so nothing opened through it escapes the media list
  • The posture no longer depends on upstream per-demuxer defaults (concat safe, hls/dash extension allowlists, mov enable_drefs). Pinning -safe 1 etc. per input was rejected: ffmpeg fails any input whose demuxer doesn't own that option

Type of Change

  • Bug fix

Testing

  • E2E against the prod image's ffmpeg 7.1.5 (non-root app user), running the real runFfmpegOperation / extractAudioFromVideo before and after:
    • 38 legitimate cases — every operation (incl. concat with silent-audio synthesis, add_text, overlay png/jpg/webp/gif), 22 container/codec types, both STT paths — succeed with byte-identical outputs pre/post
    • DASH manifest: pre-fix read an outside-temp-dir media file through convert/probe/STT; post-fix rejected with "Format not on whitelist". ffconcat, HLS (.m3u8 via declared MIME), and IMF also rejected at the format gate
  • Same matrix natively on ffmpeg 9.0: identical pre/post results for all legitimate cases
  • lib/media + lib/audio vitest (67 passing); pinned-argv expectations updated for the new flag
  • biome on changed files; full audits/type-check/tests via CI

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 2, 2026 8:39pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The PR appears safe to merge; no blocking issue remains.

Summary

The PR adds media-format allowlists to FFmpeg and FFprobe inputs. The latest change adds support for animated PNG files through apng.

  • FFmpeg and FFprobe limit inputs to media formats.

Reviews (3) · Last reviewed commit: "fix(media): allow apng demuxer" · Reviewed by Greptile

Comment thread apps/sim/lib/media/ffmpeg-process.ts Resolved
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/media/ffmpeg-process.ts Resolved
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 29dd567 into staging Nov 2, 2026
72 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/ffmpeg-input-format-whitelist branch November 2, 2026 23:26

This branch was previously deployed

1 inactive deployment
Preview — fe456216 Deployed Nov 2, 2026 by vercel[bot]
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.

1 participant