Skip to content

Business operating system for Claude Code — 57 skills, 21 agents, smart daemon. Unified inbox (WhatsApp/Email/Slack/Telegram), autonomous PR merge, full-AWS monitoring, revenue (Stripe+RevenueCat), e-commerce (Shopify), marketing (Klaviyo/Meta/GA4), voice (Bland/ElevenLabs), APM (Datadog/NewRelic/OTEL), YOLO mode.

fix(security): replace execSync shell-string commands with execFileSync argument arrays (#720)

cursor[bot]89f53b0fe75c
diff --git a/claude-ops/scripts/account-rotation/daemon.mjs b/claude-ops/scripts/account-rotation/daemon.mjs
index 9bb1c68d..c14d60ec 100644
--- a/claude-ops/scripts/account-rotation/daemon.mjs
+++ b/claude-ops/scripts/account-rotation/daemon.mjs
@@ -291,12 +291,18 @@ function readStoredToken(account) {
}
}
try {
- const out = execSync(`security find-generic-password -s "${svc}" -a "${VAULT_KEYCHAIN_ACCOUNT}" -g 2>&1`, {
+ const out = execFileSync('security', ['find-generic-password', '-s', svc, '-a', VAULT_KEYCHAIN_ACCOUNT, '-g'], {
timeout: 5000,
- }).toString();
- const m = out.match(/^password: "?(.*?)"?$/m);
+ encoding: 'utf8',
+ stdio: ['ignore', 'pipe', 'pipe'],
+ });
+ const combined = out || '';
+ const m = combined.match(/^password: "?(.*?)"?$/m);
return m ? m[1].replace(/\\"/g, '"') : null;
- } catch {
+ } catch (e) {
+ const stderr = e.stderr?.toString?.() || '';
+ const m = stderr.match(/^password: "?(.*?)"?$/m);
+ if (m) return m[1].replace(/\\"/g, '"');
return null;
}
}
@@ -329,15 +335,18 @@ function readActiveKeychainToken() {
}
}
try {
- const out = execSync(
- `security find-generic-password -s "Claude Code-credentials" -a "${ACTIVE_KEYCHAIN_ACCOUNT}" -g 2>&1`,
- {
- timeout: 5000,
- },
- ).toString();
- const m = out.match(/^password: "?(.*?)"?$/m);
+ const out = execFileSync(
+ 'security',
+ ['find-generic-password', '-s', 'Claude Code-credentials', '-a', ACTIVE_KEYCHAIN_ACCOUNT, '-g'],
+ { timeout: 5000, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] },
+ );
+ const combined = out || '';
+ const m = combined.match(/^password: "?(.*?)"?$/m);
return m ? m[1].replace(/\\"/g, '"') : null;
- } catch {
+ } catch (e) {
+ const stderr = e.stderr?.toString?.() || '';
+ const m = stderr.match(/^password: "?(.*?)"?$/m);
+ if (m) return m[1].replace(/\\"/g, '"');
return null;
}
}
diff --git a/claude-ops/scripts/account-rotation/rotate.mjs b/claude-ops/scripts/account-rotation/rotate.mjs
index a0afeb39..f923b6ea 100644
--- a/claude-ops/scripts/account-rotation/rotate.mjs
+++ b/claude-ops/scripts/account-rotation/rotate.mjs
@@ -2250,7 +2250,7 @@ async function makeManualDriver() {
return {
name: 'manual',
async goto(url) {
- execSync(`open "${url}"`);
+ execFileSync('open', [url]);
notify('Account Rotation', 'Complete Google sign-in → click Allow');
},
async currentUrl() {
@@ -2725,7 +2725,7 @@ async function runAuthFlow(driver, account) {
if (codeMatch && driver._localhostPort) {
const replayUrl = `http://localhost:${driver._localhostPort}/callback?code=${codeMatch[1]}${stateMatch ? '&state=' + stateMatch[1] : ''}`;
try {
- execSync(`curl -s "${replayUrl}" -o /dev/null`, { timeout: 5000 });
+ execFileSync('curl', ['-s', replayUrl, '-o', '/dev/null'], { timeout: 5000 });
} catch {}
}
return true;
diff --git a/installer/src/source.mjs b/installer/src/source.mjs
index 8d3306cd..5cb54364 100644
--- a/installer/src/source.mjs
+++ b/installer/src/source.mjs
@@ -5,7 +5,7 @@
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
-import { execSync } from "node:child_process";
+import { execFileSync } from "node:child_process";
export const CACHE_ROOT = path.join(
os.homedir(),
@@ -13,8 +13,8 @@ export const CACHE_ROOT = path.join(
"claude-ops-installer",
);
-function sh(cmd, opts = {}) {
- return execSync(cmd, {
+function git(args, opts = {}) {
+ return execFileSync("git", args, {
encoding: "utf8",
stdio: ["ignore", "pipe", "pipe"],
...opts,
@@ -23,7 +23,7 @@ function sh(cmd, opts = {}) {
export function resolveRef(srcDir) {
try {
- return sh(`git -C "${srcDir}" rev-parse HEAD`);
+ return git(["-C", srcDir, "rev-parse", "HEAD"]);
} catch (_e) {
return null;
}
@@ -39,7 +39,6 @@ function cacheKey(cfg) {
export function ensureSource(cfg) {
const dir = path.join(CACHE_ROOT, cacheKey(cfg));
- // The marketplace repo nests the actual plugin at <repo>/claude-ops/. That's where skills/ and bin/ live.
const skillsDir = path.join(dir, "claude-ops", "skills");
const binDir = path.join(dir, "claude-ops", "bin");
fs.mkdirSync(CACHE_ROOT, { recursive: true });
@@ -51,10 +50,9 @@ export function ensureSource(cfg) {
};
}
if (fs.existsSync(path.join(dir, ".git"))) {
- // Stale partial — try to update.
try {
- sh(`git -C "${dir}" fetch --depth 1 origin ${cfg.source.ref}`);
- sh(`git -C "${dir}" reset --hard FETCH_HEAD`);
+ git(["-C", dir, "fetch", "--depth", "1", "origin", cfg.source.ref]);
+ git(["-C", dir, "reset", "--hard", "FETCH_HEAD"]);
if (fs.existsSync(path.join(skillsDir, "ops-inbox", "SKILL.md"))) {
return {
dir: path.join(dir, "claude-ops"),
@@ -69,11 +67,10 @@ export function ensureSource(cfg) {
fs.rmSync(dir, { recursive: true, force: true });
const url = cfg.source.url;
const ref = cfg.source.ref;
- // Shallow clone, then checkout the ref.
- sh(`git clone --depth 1 --no-tags --filter=blob:none "${url}" "${dir}"`);
+ git(["clone", "--depth", "1", "--no-tags", "--filter=blob:none", url, dir]);
try {
- sh(`git -C "${dir}" fetch --depth 1 origin ${ref}`);
- sh(`git -C "${dir}" checkout FETCH_HEAD`);
+ git(["-C", dir, "fetch", "--depth", "1", "origin", ref]);
+ git(["-C", dir, "checkout", "FETCH_HEAD"]);
} catch (e) {
throw new Error(`source: failed to fetch ref ${ref}: ${e.message}`);
}