Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review: 4 Copilot findings on v1.54.0 PR (iter 3)
[._.]/ Adam Eivy4d2394d6998a
diff --git a/server/index.js b/server/index.jsindex 33bfcc3fcd..c90ef51e39 100644--- a/server/index.js+++ b/server/index.js@@ -223,11 +223,14 @@ aiToolkit.services.providers.getAllProviders().catch(err => {console.error(`❌ Failed to load providers at startup: ${err.message}`);});-// Patch toolkit's runner to fix shell security issue (DEP0190)-// Override executeCliRun to remove 'shell: true' which causes security warnings+// Swap the toolkit's generic executeCliRun for PortOS's variant that adds+// CLI-provider-specific args building (Codex `exec -`, Gemini stdin piping,+// Claude Code `-p -`). The toolkit's in-tree implementation is also safe+// (no shell, prompt via stdin) — the PortOS variant exists for the per-CLI+// invocation conventions, not for security.import { executeCliRun as executeCliRunFixed } from './services/runner.js';aiToolkit.services.runner.executeCliRun = executeCliRunFixed;-console.log('🔧 Patched aiToolkit runner.executeCliRun to fix shell security issue');+console.log('🔧 Patched aiToolkit runner.executeCliRun with PortOS CLI variants');// Note: prompts service is initialized automatically by createAIToolkit()diff --git a/server/lib/aiToolkit/runner.js b/server/lib/aiToolkit/runner.jsindex 864e2cd761..35d89b21b5 100644--- a/server/lib/aiToolkit/runner.js+++ b/server/lib/aiToolkit/runner.js@@ -185,14 +185,22 @@ export function createRunnerService(config = {}) {const startTime = Date.now();let output = '';- const args = [...(provider.args || []), prompt];- console.log(`🚀 Executing CLI: ${provider.command} ${provider.args?.join(' ') || ''}`);+ // Pass the prompt via stdin (not argv) and run without a shell so that+ // user-configurable `provider.command` cannot inject extra commands via+ // shell metacharacters, and so the full prompt isn't visible in+ // process listings as a single command-line argument.+ const args = [...(provider.args || [])];+ console.log(`🚀 Executing CLI: ${provider.command} ${args.join(' ')} (${prompt.length} chars via stdin)`);const childProcess = spawn(provider.command, args, {cwd: workspacePath,env: { ...process.env, ...provider.envVars },- shell: true+ windowsHide: true});+ if (childProcess.stdin) {+ childProcess.stdin.write(prompt);+ childProcess.stdin.end();+ }activeRuns.set(runId, childProcess);hooks.onRunStarted?.({ runId, provider: provider.name, model: provider.defaultModel });diff --git a/server/routes/providers.js b/server/routes/providers.jsindex 2490dbdc8f..87b2ec8e5b 100644--- a/server/routes/providers.js+++ b/server/routes/providers.js@@ -158,7 +158,21 @@ export function createPortOSProviderRoutes(aiToolkit) {res.json(sanitizeProvider(provider));}));- // Mount base toolkit routes last (GET/PUT /:id are now shadowed by sanitized versions above)+ // POST / — intercept to sanitize the created provider before responding so+ // apiKey and secret envVar values don't echo back to the client (the+ // toolkit's POST returns the raw provider object).+ router.post('/', asyncHandler(async (req, res) => {+ const { name, type } = req.body;+ if (!name) return res.status(400).json({ error: 'Name is required' });+ if (!type || !['cli', 'api'].includes(type)) {+ return res.status(400).json({ error: 'Type must be "cli" or "api"' });+ }+ const provider = await providerService.createProvider(req.body);+ res.status(201).json(sanitizeProvider(provider));+ }));++ // Mount base toolkit routes last (GET/PUT /:id and POST / are now shadowed+ // by sanitized versions above)router.use('/', aiToolkit.routes.providers);return router;