Skip to content

Commit 8db691a

Browse files
authored
Merge pull request #16 from aayoawoyemi/fix/remove-shell-true-hooks
fix: remove shell: true from spawnSync calls in hooks (CWE-78)
2 parents 0d70c4b + c08924d commit 8db691a

3 files changed

Lines changed: 4 additions & 6 deletions

File tree

adapters/claude-code/hooks/capture.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ if (!findVaultRoot(process.cwd())) {
5858
process.exit(0);
5959
}
6060

61-
const result = spawnSync("ori", ["add", title, "--type", "insight"], { stdio: "inherit", shell: true });
61+
const result = spawnSync("ori", ["add", title, "--type", "insight"], { stdio: "inherit" });
6262
if (result.error) process.exit(0);
6363
process.exit(result.status ?? 0);

adapters/claude-code/hooks/orient.mjs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,11 @@ if (!vaultRoot) {
2727
const healthResult = spawnSync("ori", ["health"], {
2828
encoding: "utf8",
2929
timeout: 8000,
30-
shell: true,
3130
});
3231

3332
if (healthResult.error || healthResult.status !== 0) {
3433
// Fallback to basic status
35-
const result = spawnSync("ori", ["status"], { stdio: "inherit", shell: true });
34+
const result = spawnSync("ori", ["status"], { stdio: "inherit" });
3635
process.exit(result.status ?? 0);
3736
}
3837

@@ -89,7 +88,6 @@ try {
8988
const gitResult = spawnSync("git", ["remote", "get-url", "origin"], {
9089
encoding: "utf8",
9190
timeout: 3000,
92-
shell: true,
9391
});
9492
if (!gitResult.error && gitResult.stdout) {
9593
const repoName = path
@@ -104,7 +102,7 @@ try {
104102
console.log(lines.join("\n"));
105103
} catch {
106104
// JSON parse failed, fall back to status
107-
const result = spawnSync("ori", ["status"], { stdio: "inherit", shell: true });
105+
const result = spawnSync("ori", ["status"], { stdio: "inherit" });
108106
process.exit(result.status ?? 0);
109107
}
110108

adapters/claude-code/hooks/validate.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ if (!normalizedFile.startsWith(normalizedVault)) {
6363
process.exit(0);
6464
}
6565

66-
const result = spawnSync("ori", ["validate", filePath], { stdio: "inherit", shell: true });
66+
const result = spawnSync("ori", ["validate", filePath], { stdio: "inherit" });
6767
if (result.error) process.exit(0);
6868
process.exit(result.status ?? 0);

0 commit comments

Comments
 (0)