From d234360e8afcb88d7648b3b0b4548f19d62fdf49 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 4 Sep 2026 06:32:41 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A1=EF=B8=8F=20Sentinel:=20[HIGH]=20Fi?= =?UTF-8?q?x=20command=20injection=20in=20transcribeAudio=20tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: adihex <82704954+adihex@users.noreply.github.com> --- .jules/sentinel.md | 5 +++++ apps/zettel/src/tools/transcribe.ts | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 .jules/sentinel.md diff --git a/.jules/sentinel.md b/.jules/sentinel.md new file mode 100644 index 0000000..4b53157 --- /dev/null +++ b/.jules/sentinel.md @@ -0,0 +1,5 @@ +## 2026-09-02 - Sentinel: Mitigate Command Injection Vulnerability in transcribe.ts + +**Vulnerability:** In `apps/zettel/src/tools/transcribe.ts`, the `binaryAvailable` function used `sh -c command -v ${bin}` which was susceptible to command injection if the `bin` argument (derived from `process.env.WHISPER_BIN`) contained shell metacharacters. +**Learning:** Even when reading from environment variables, interpolating strings into shell execution wrappers (`sh -c`) can expose systems to command injection vulnerabilities. `execFileSync` without `shell: true` should be preferred. +**Prevention:** Avoid using shell interpolation to evaluate environment variables or command-line arguments. Instead, use an argument array to pass executable names securely. For checking binary existence on `$PATH`, `execFileSync("which", [bin])` safely prevents shell execution by relying directly on the `which` executable and standard IO bindings. diff --git a/apps/zettel/src/tools/transcribe.ts b/apps/zettel/src/tools/transcribe.ts index a67d019..e74cadd 100644 --- a/apps/zettel/src/tools/transcribe.ts +++ b/apps/zettel/src/tools/transcribe.ts @@ -41,8 +41,7 @@ function binaryAvailable(bin: string): boolean { // Absolute/relative path → just check the file. if (bin.includes(path.sep)) return fs.existsSync(bin); try { - // `command -v` resolves builtins/PATH entries; argv array, no shell injection. - execFileSync("/usr/bin/env", ["sh", "-c", `command -v ${bin}`], { stdio: "ignore" }); + execFileSync("which", [bin], { stdio: "ignore" }); return true; } catch { return false;