Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 1 addition & 2 deletions apps/zettel/src/tools/transcribe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading