8000 fix(media): let ffmpeg read only audio and video containers by adeelahmad · Pull Request #196 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

fix(media): let ffmpeg read only audio and video containers - #196

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-qt650x-ffmpeg-formats
Oct 6, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/project-thread-qt650x-ffmpeg-formats

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: Lens checks only the file extension of an upload, but ffmpeg picks a demuxer from the file's content. Take a file named clip.mp3 whose content is an ffconcat list saying file secret.wav. ffprobe reported format_name=concat, and decoding returned the other file's audio, which would then be transcribed. A folder-scan import or a voice clip in /tmp could reach whatever media sits next to it. HLS playlists were already refused by ffmpeg's own extension check.

After: every ffmpeg and ffprobe call on a file (ingest.probe, ingest.decode, and the four in video.py) passes -format_whitelist with the containers Lens imports (mp3, mov/mp4, wav, flac, ogg, aac, matroska/webm, amr, avi, asf, mpeg, mpegts, aiff). Playlists, concat lists and image sequences are refused.

Motivation and Context

This answers threat-model question Q21: an upload that makes ffmpeg read another file is VALID under P-NO-INJECTION. -protocol_whitelist would not help, because file: is the protocol being abused. The whitelist also applies to inputs nested inside another one.

Steps to reproduce (if appropriate):

test_ffmpeg_refuses_playlists_that_point_at_other_files decoded the neighbouring WAV on main and now raises. The video, voice, speech, encryption and import tests still pass locally. The full backend suite had one failure, in LibreOffice conversion, which fails the same way on main in this environment.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests.
  • My change requires documentation updates, and I have updated docs/ accordingly.
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md.

🤖 Generated with Claude Code

https://claude.ai/code/session_01W42z4FbekWr33b6791svQQ


Generated by Claude Code

ffmpeg picks a demuxer by content, not by extension, so an upload named
clip.mp3 that was really an ffconcat list made it read another media file
in the same folder. Every ffmpeg and ffprobe call on a file now passes a
-format_whitelist of the containers Lens imports.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W42z4FbekWr33b6791svQQ
@adeelahmad adeelahmad self-assigned this Oct 6, 2026
@adeelahmad
adeelahmad merged commit afc19fd into main Oct 6, 2026
5 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-qt650x-ffmpeg-formats branch October 6, 2026 10:35
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.

2 participants

0