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.
Shell agent-teamsai-agentai-automationanthropicautonomous-agentawsbusiness-operationsclaudeclaude-codeclaude-code-plugindevopsecommerceinbox-zeroklaviyomarketingmcpmorning-briefingpr-automationshopifyterminal
fix(security): eliminate CodeQL critical command-line injection (#794)
Aurora Capitald5a7aa5c8798
diff --git a/claude-ops/bin/ops-telegram-autolink.mjs b/claude-ops/bin/ops-telegram-autolink.mjsindex daee2dcc..7c748e6e 100755--- a/claude-ops/bin/ops-telegram-autolink.mjs+++ b/claude-ops/bin/ops-telegram-autolink.mjs@@ -36,7 +36,7 @@*/import { readFileSync, existsSync, unlinkSync } from 'node:fs';-import { execSync } from 'node:child_process';+import { execSync, execFileSync } from 'node:child_process';import { parseArgs } from 'node:util';import os from 'node:os';import { TelegramClient } from 'telegram';@@ -470,17 +470,30 @@ try {// Step 2.3: Register MCP servertry {- const pluginRoot =- process.env.CLAUDE_PLUGIN_ROOT || execSync('echo $CLAUDE_PLUGIN_ROOT', { encoding: 'utf8' }).trim();+ // Argv form — never interpolate secrets into a shell string (CodeQL js/command-line-injection).+ const pluginRoot = (process.env.CLAUDE_PLUGIN_ROOT || '').trim();const telegramServerPath = pluginRoot ? `${pluginRoot}/telegram-server/index.js` : null;if (telegramServerPath) {- execSync(- `claude mcp add telegram -s user` +- ` -e TELEGRAM_API_ID='${apiId}'` +- ` -e TELEGRAM_API_HASH='${apiHash}'` +- ` -e TELEGRAM_PHONE='${PHONE}'` +- ` -e TELEGRAM_SESSION='${sessionStr.replace(/'/g, "'\\''")}'` +- ` -- node "${telegramServerPath}"`,+ execFileSync(+ 'claude',+ [+ 'mcp',+ 'add',+ 'telegram',+ '-s',+ 'user',+ '-e',+ `TELEGRAM_API_ID=${apiId}`,+ '-e',+ `TELEGRAM_API_HASH=${apiHash}`,+ '-e',+ `TELEGRAM_PHONE=${PHONE}`,+ '-e',+ `TELEGRAM_SESSION=${sessionStr}`,+ '--',+ 'node',+ telegramServerPath,+ ],{ timeout: 15000, stdio: 'pipe' },);emit({diff --git a/claude-ops/lib/credential-store.mjs b/claude-ops/lib/credential-store.mjsindex 4ea34549..38974154 100644--- a/claude-ops/lib/credential-store.mjs+++ b/claude-ops/lib/credential-store.mjs@@ -49,6 +49,12 @@ async function ensureDataDir() {// ─── 1. OS-native backends ───────────────────────────────────────────────────function runSync(cmd, args, opts = {}) {+ // Allowlist fixed binary names only. Never pass user-controlled cmd+ // (CodeQL js/command-line-injection on spawnSync first arg).+ const ALLOWED = new Set(['security', 'secret-tool', 'which', 'cmd.exe', 'cmdkey', 'powershell', 'pwsh']);+ if (!ALLOWED.has(cmd)) {+ throw new Error(`credential-store: refused non-allowlisted command: ${cmd}`);+ }return spawnSync(cmd, args, { encoding: 'utf8', ...opts });}@@ -70,7 +76,8 @@ function macDelete(service, account) {// --- Linux libsecret (secret-tool) ---function hasSecretTool() {- return runSync('sh', ['-c', 'command -v secret-tool']).status === 0;+ // Fixed argv only — no shell (CodeQL js/command-line-injection).+ return runSync('secret-tool', ['--version']).status === 0 || runSync('which', ['secret-tool']).status === 0;}function stSet(service, account, secret) {if (!hasSecretTool()) return false;@@ -95,7 +102,7 @@ function stDelete(service, account) {// --- Windows Credential Manager (cmdkey — write-only from CLI) ---function hasCmd() {- return runSync('sh', ['-c', 'command -v cmd.exe || which cmd.exe']).status === 0 || process.platform === 'win32';+ return process.platform === 'win32' || runSync('which', ['cmd.exe']).status === 0;}function wincredSet(service, account, secret) {if (!hasCmd()) return false;