diff --git a/packages/cli/src/commands/init.ts b/packages/cli/src/commands/init.ts index b470da0f8..b8905f2d3 100644 --- a/packages/cli/src/commands/init.ts +++ b/packages/cli/src/commands/init.ts @@ -109,7 +109,7 @@ function probeVideo(filePath: string): VideoMeta | undefined { if (!ffprobePath) return undefined; const raw = execFileSync( ffprobePath, - ["-v", "quiet", "-print_format", "json", "-show_format", "-show_streams", filePath], + ["-v", "quiet", "-print_format", "json", "-show_format", "-show_streams", "--", filePath], { encoding: "utf-8", timeout: 15_000 }, ); diff --git a/packages/cli/src/utils/webmAlphaCheck.ts b/packages/cli/src/utils/webmAlphaCheck.ts index d52f1d72a..75b8ae159 100644 --- a/packages/cli/src/utils/webmAlphaCheck.ts +++ b/packages/cli/src/utils/webmAlphaCheck.ts @@ -86,6 +86,7 @@ function probeWebmAlpha(filePath: string): WebmAlphaProbe { "stream=codec_name:stream_tags=alpha_mode", "-of", "json", + "--", filePath, ], { encoding: "utf-8", timeout: 15_000 }, diff --git a/packages/cli/src/whisper/transcribe.ts b/packages/cli/src/whisper/transcribe.ts index 6641edb95..c511a2b53 100644 --- a/packages/cli/src/whisper/transcribe.ts +++ b/packages/cli/src/whisper/transcribe.ts @@ -171,6 +171,7 @@ function getMediaDurationSeconds(filePath: string): number | null { "format=duration", "-of", "default=noprint_wrappers=1:nokey=1", + "--", filePath, ], { encoding: "utf-8", timeout: 10_000 }, @@ -329,7 +330,7 @@ function isWav16kMono(filePath: string): boolean { if (!ffprobePath) return false; const raw = execFileSync( ffprobePath, - ["-v", "quiet", "-print_format", "json", "-show_streams", filePath], + ["-v", "quiet", "-print_format", "json", "-show_streams", "--", filePath], { encoding: "utf-8", timeout: 10_000 }, ); const parsed: { diff --git a/packages/core/src/mediaGradeAnalyzer.ts b/packages/core/src/mediaGradeAnalyzer.ts index 7ea693435..ca6c12913 100644 --- a/packages/core/src/mediaGradeAnalyzer.ts +++ b/packages/core/src/mediaGradeAnalyzer.ts @@ -121,6 +121,7 @@ function probeMedia(mediaPath: string, ffprobePath: string): GradeMediaProbe { "stream=color_space,color_transfer,color_primaries,pix_fmt,duration:format=duration", "-of", "json", + "--", mediaPath, ], { encoding: "utf8", timeout: 5_000, stdio: ["ignore", "pipe", "pipe"] }, diff --git a/packages/lint/src/hevcPreviewLint.ts b/packages/lint/src/hevcPreviewLint.ts index 9a6cfba85..e0cc086c0 100644 --- a/packages/lint/src/hevcPreviewLint.ts +++ b/packages/lint/src/hevcPreviewLint.ts @@ -57,6 +57,7 @@ async function probeIsHevc(ffprobePath: string, filePath: string): Promise(args: string[], signal?: AbortSignal): Promise { - const proc = spawn(getFfprobeBinary(), args); + // Callers bake the input path into `args` (terminated with "--"), so this + // helper cannot add the terminator itself — assert they did rather than + // let a dash-prefixed path silently reach ffprobe as an option. + if (!args.includes("--")) { + throw new Error('[audioPadTrim] ffprobe args must terminate options with "--".'); + } + const proc = spawn(getFfprobeBinary(), args, { stdio: ["ignore", "pipe", "pipe"] }); trackChildProcess(proc); let stdout = ""; proc.stdout.on("data", (data: Buffer) => { @@ -452,7 +461,9 @@ async function runFfprobeJson(args: string[], signal?: AbortSignal): Promise< throw outcome.error ?? new Error(outcome.stderr); } if (outcome.reason !== "exit" || outcome.exitCode !== 0) { - throw new Error(`ffprobe ${outcome.reason}: ${outcome.stderr}`); + // Redacted: raw ffprobe stderr echoes the input path, and this message + // reaches logs and telemetry. + throw new Error(`ffprobe ${outcome.reason}: ${redactTelemetryString(outcome.stderr, 2000)}`); } try { return JSON.parse(stdout) as T;