feat: validate filter string params for clean errors (#22)#31
Merged
Conversation
A typo'd transition name or a color containing filtergraph metacharacters previously corrupted the filtergraph and surfaced as a cryptic ffmpeg parse error. Add utils/validate.ts: - validateTransition: xfade transition must be lowercase letters (version independent; catches separators/spaces/metacharacters). - validateColor: rejects filtergraph metacharacters in a color value; ffmpeg still validates the actual color. Wired into buildXfadeArgs / buildAssembleArgs (transition) and buildTitleCardArgs (bg, fontColor) / buildRedactArgs (color). Not a security boundary (args run without a shell); a usability fix. Pure validators, unit tested. Fixes #22 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Fixes #22.
Problem
Several user-supplied strings flow into ffmpeg filtergraphs. A typo'd transition name or a color containing a
:/,corrupted the graph and surfaced as a cryptic ffmpeg parse error. (Not a security issue: args are passed without a shell.)Fix
New
utils/validate.ts:validateTransition-- xfade transition must be lowercase letters (version-independent; catches separators, spaces, and metacharacters).validateColor-- rejects filtergraph metacharacters in a color value; ffmpeg still validates the real color name/hex.Wired into
buildXfadeArgs/buildAssembleArgs(transition) andbuildTitleCardArgs(bg,fontColor) /buildRedactArgs(color).Verification
npm run build,npm run typecheck,npm testpass (136 passed, 5 skipped; +5 validator tests). Existing defaults (fade/cut/black/white) pass validation.🤖 Generated with Claude Code