Skip to content

feat: validate filter string params for clean errors (#22)#31

Merged
TMHSDigital merged 1 commit into
mainfrom
fix/22-validate-filter-params
Jun 16, 2026
Merged

feat: validate filter string params for clean errors (#22)#31
TMHSDigital merged 1 commit into
mainfrom
fix/22-validate-filter-params

Conversation

@TMHSDigital

Copy link
Copy Markdown
Owner

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) and buildTitleCardArgs (bg, fontColor) / buildRedactArgs (color).

Verification

  • npm run build, npm run typecheck, npm test pass (136 passed, 5 skipped; +5 validator tests). Existing defaults (fade/cut/black/white) pass validation.

🤖 Generated with Claude Code

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>
@TMHSDigital TMHSDigital merged commit 164cc28 into main Jun 16, 2026
6 checks passed
@TMHSDigital TMHSDigital deleted the fix/22-validate-filter-params branch June 16, 2026 18:14
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.

Enhancement: validate string filter parameters for clean errors

1 participant