Skip to content

Write HTML. Render video. Built for agents.

fix(cli,core,lint,producer): terminate ffprobe options at every call site

Vance Ingalls47564ab94cc4
diff --git a/packages/cli/src/commands/init.ts b/packages/cli/src/commands/init.ts
index b470da0f86..b8905f2d3b 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 d52f1d72aa..75b8ae159b 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 6641edb95e..c511a2b535 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 7ea693435a..ca6c129135 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 9a6cfba853..e0cc086c0b 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<boole
"stream=codec_name",
"-of",
"json",
+ "--",
filePath,
]);
return hasHevcStream(JSON.parse(stdout));
diff --git a/packages/producer/src/plan-parity-analysis.ts b/packages/producer/src/plan-parity-analysis.ts
index 3ab31650d5..1d7579fc4c 100644
--- a/packages/producer/src/plan-parity-analysis.ts
+++ b/packages/producer/src/plan-parity-analysis.ts
@@ -119,6 +119,7 @@ function probeMetadata(outputPath: string): PlanParityStreamMetadata {
].join(":"),
"-of",
"json",
+ "--",
outputPath,
]);
return normalizeFfprobeMetadata(JSON.parse(bytes.toString("utf-8")) as unknown);
diff --git a/packages/producer/src/services/render/audioPadTrim.ts b/packages/producer/src/services/render/audioPadTrim.ts
index 9aa30503f2..7ba6f37b1a 100644
--- a/packages/producer/src/services/render/audioPadTrim.ts
+++ b/packages/producer/src/services/render/audioPadTrim.ts
@@ -30,6 +30,7 @@ import {
trackChildProcess,
type AudioMetadata,
} from "@hyperframes/engine";
+import { redactTelemetryString } from "@hyperframes/core";
/**
* Tolerance used to decide whether an audio file is already short enough to
@@ -361,6 +362,7 @@ async function defaultProbeVideoFrameInfo(
"stream=nb_frames,r_frame_rate",
"-of",
"json",
+ "--",
videoPath,
],
signal,
@@ -381,6 +383,7 @@ async function defaultProbeVideoFrameInfo(
"stream=nb_read_packets,r_frame_rate",
"-of",
"json",
+ "--",
videoPath,
],
signal,
@@ -434,7 +437,13 @@ async function defaultRunFfmpeg(
// ── ffprobe JSON runner (shared between fast/slow video probe paths) ─────
async function runFfprobeJson<T>(args: string[], signal?: AbortSignal): Promise<T> {
- 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<T>(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;