Skip to content
Open
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
4 changes: 4 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## 2026-11-11 - [CRITICAL] Command Injection via execSync
**Vulnerability:** The codebase was using `child_process.execSync` which invokes a shell, making it susceptible to command injection attacks if user inputs or environment variables are not properly sanitized.
**Learning:** `execSync` executes commands within a shell environment which automatically expands shell variables and parses metacharacters, a significant security risk for a local safety harness meant for potentially adversarial agents.
**Prevention:** Always use `child_process.execFileSync` instead. It does not spawn a shell by default, meaning arguments are passed exactly as provided without expansion or interpretation. Use array-based arguments and specifically `process.execPath` for node scripts.
18 changes: 11 additions & 7 deletions packages/core/src/loop.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { execSync } from "node:child_process";
import { execFileSync } from "node:child_process";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
Expand Down Expand Up @@ -173,12 +173,16 @@ describe("ledger benchmark e2e", () => {
it("reconcile passes validator for correct ledger implementation", () => {
const dir = setupWorkspace();
const mergeTarget = path.join(dir, "auth_service.js");
execSync(`node "${fixturePath("mock-dev-ledger.mjs")}" "${path.join(dir, "developer_output.json")}"`, {
stdio: "pipe",
});
execSync(`node "${fixturePath("mock-audit-pass.mjs")}" "${path.join(dir, "auditor_output.json")}"`, {
stdio: "pipe",
});
execFileSync(
process.execPath,
[fixturePath("mock-dev-ledger.mjs"), path.join(dir, "developer_output.json")],
{ stdio: "pipe" }
);
execFileSync(
process.execPath,
[fixturePath("mock-audit-pass.mjs"), path.join(dir, "auditor_output.json")],
{ stdio: "pipe" }
);

const result = reconcile({
workspace: dir,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/reconcile.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { execSync } from "node:child_process";
import { execFileSync } from "node:child_process";
import crypto from "node:crypto";
import fs from "node:fs";
import path from "node:path";
Expand Down Expand Up @@ -139,7 +139,7 @@ export function reconcile(options: ReconcileOptions): ReconcileResult {
fs.writeFileSync(tempFile, extractedCode, "utf8");

try {
execSync(`node --check "${tempFile}"`, { stdio: "pipe" });
execFileSync(process.execPath, ["--check", tempFile], { stdio: "pipe" });
log.audit("Syntax check passed");
} catch (err) {
const stderr =
Expand Down
Loading